04-06-2012 12:40 AM - edited 04-06-2012 12:42 AM
The only thing that looks strange, but which I have to assume is a webformating issue of this forum is the concatenated void__cdecl, as that would never compile.
But!!!!
The fact that the function seemed to crash on a string allocated through Path To String but worked when used with a Diagramm Constant tells me, that the function possibly did do something with the path string passed in despite your claims otherwise.
An extra security in this aspect would be to declare the two input strings explicitedly as const, as that would usually cause a compile warning or error if your collegue passes the path string to a function that might try to modify it in any way.
A function that works without knowing why is the worst. I never would release a software with such a function without VERY tortorous testing.
04-06-2012 07:27 AM
Rolf,
I checked the actual code. You are correct, the actual code is "void __cdecl". The missing space must have been lost in the copy/paste.
The function didn't exactly "work" when I changed the paths from converted strings to constants: the method of failure simply changed. Instead of crashing, I got an unhandled exception.
My coworker changed something in the source code of the DLL that made it start working. However, it shouldn't have started working as far as we know. Further discussions with him indicated that all he added was some code to allow more stack space (I think that is what he said). He suspects that somehow LabVIEW was limiting the amount of space for the stack and that this was causing a stack overflow.
Having done some assembly language programming on old 8 bit microcontrollers, I have a basic understanding of what a stack is and how an overflow could be bad. But I don't have the expertise to support nor dispute his claims.
At any rate, this software is for internal use only. We have no designs (at the moment) for this to ever be released to customers. So, I have a feeling that as long as it keeps working, there may be nothing more done to fix this.
I want to thank everyone who offered ideas to try. You all make this community a great place.
Joe