LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

passing a parameter to a labview call library function node

Hi,

I have a some labview code that I use to call a reference .dll.  The .dll is written in winapi C++ and uses a library to open and perform tasks in a third party program.  The third party software performs an analysis on some data and has several options that can be controlled with the library they provided, some of which require user input from labview.

The C++ code I wrote had all the options hard coded in... I could change the options in the code, recompile, and everything worked fine.

The next step was to pass one of the parameters through labview into my code.  Here is my prototype:
extern "C" void __declspec(dllexport) RunDynaLS( short int *NumComps );

The third party software does everything perfectly, but when it finishes, labview crashes.

Some things I've tried are to pass the value itself instead of a pointer, and putting the call library function node in a sequence to check if it gets to the next frame... it doesn't.  I've also tried passing the value as a long... the third party s/w works, but labview still crashes in the end.

I'm sure the problem has to do with memory allocation and release, but I don't know how to fix it.

Thanks for any help.
0 Kudos
Message 1 of 4
(2,738 Views)
Just wanted to attach my labview code...
0 Kudos
Message 2 of 4
(2,737 Views)
One thing to try is to change the calling convention.  The two choices are Standard (WINAPI) and C Calling Convention.  Try changing this setting.  Sometimes this elimintes the crash.  If not, you could have a misbehaving DLL, not cleaning up memory it allocates, or not cleaning the stack or something like that.
- tbob

Inventor of the WORM Global
Message 3 of 4
(2,728 Views)
Thanks tbob!  Changing the calling convention to C fixed it.
0 Kudos
Message 4 of 4
(2,723 Views)