The OP's posted code does not pass the cstr1/cstr2 into the FORTRAN function anyway. As written it should not compile, so I guess the OP is actually passing the char pointers.
As for why it differs in Win 7 versus Win 10. Seems like luck that it works "most of the time" anywhere. For it to work, the second toLocal8Bit() call would have to cause the QByteArray to reallocate its internal buffer to hold the second string (e.g. the second string is longer), and the operating system would have to give it a distinct chunk of memory that was not simply an extension of the original buffer (i.e. not a realloc()), and the OS would have to not allocate the original buffer memory to anyone else or remove it from the process' memory space. Perhaps Win 10 has different memory allocation method or one that deliberately zeros/fills deallocated memory areas. Could also be the difference between a debug/release build or compiler/runtime optimizations for the target CPU.
Yes, sorry, the call should be:
execute(&ncpu,cstr1,&len1,cstr2,&len2,&res);
I don't use debug builds. Should I create another QByteArray?
Bookmarks