07-07-2022 07:29 AM
Hi,
I'm updating some old code running on labview with labwindows dlls. I updated all the old 32bits dll to 64bits dll and now debugging.
While executing the labview exe (in debug mode with labwindows dll) I get a fatal run time error in labwindows during the call of one function of a dll :
The call :
The error :
The trace function is really simple and writes the char array to a file :
void __stdcall Trace(char message[BUFFER_SIZE])
{
if (flag_trace) fprintf(file_trace, "%s", message);
}
The mos suprizing thing is that juste before the call to the trace function there is a call to another log function called JdB() and it is exactly the same definition, and I get no errors, so it's not a path, or a file permission thing, I really don't understand why the first call to JdB() works perfectly and the call to Trace() just after with the same architecture crashes...
It looks like the program doesnt even go inside the trace() function but crashes at the call.
I don't know why it is expecting 21474837bytes (2^31 -1) and especially why it works with the first function and not the second...
Thanks
Solved! Go to Solution.
07-07-2022 02:03 PM
Any chance BUFFER_SIZE is undefined when used? It sort of sounds like a negative integer value is being evaluated as a very large positive int.
07-08-2022 01:41 AM
Solved: after some research it turned out that the problem came from the function name: trace(), I changed it and everything works normally.
There is indeed a trace() function (with a different prototype) in a LabWindows library but it was not included and there was no indication of a conflict...
So maybe a bug ?
07-08-2022 03:26 AM
Maybe it's declared as _weak_, but I can't find it in the libs (where did you find it?). There is a Trace() in the Advanced Analysis Library for matrix stuff.
07-08-2022 03:44 AM
Yes its the the Trace() function of Advanced Analysis Library.
Well I think, I don't see any other explanation but maybe there is...
Because when compiling the Trace() calls it offered to include this library when I removed the prototype and the definition of my own Trace() function so I deduced that but maybe it's hasty.
07-11-2022 04:39 AM
It's probably a question of the default linking order. In some way it's indeed a bug as the linker should first search the local compiled project libraries for symbols before trying to link to standard libraries. On the other hand, it is probably not as simple and with the llvm backend it may be even out of control of LabWindows/CVI.
Did you include the Advanced Analysis Library in your project settings as included? Do you use any functions of that library? If not you would just need to make sure it is not selected as a project library. But trying to not conflict with symbol names of standard libraries is of course always the better solution.