LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

why labview crashes when i call vc++ DLL?

hi,
I have a little problem to the implementation of dll files in Labview.
I used VC++ to create a simple DLL file( which is attached to this message)and use "call library node" and set the parameters but when running the Labview file it sends a windows error and close the Labview program
banner,
0 Kudos
Message 1 of 2
(2,275 Views)
Hi Banner,

Since didn't attach the VI that calls the DLL in you last post, I can only guess what goes wrong. Here are some of the most important things to remember:

  1. Allocate strings and arrays in LabVIEW before calling the DLL. Pass the allocated data to the left terminal of the parameter you need the data being returned from. If the size of the allocated string or array isn't sufficient, the returned data will overflow memory and most likely result in a crash. Therefore, when allocating the string or array, it's important that it's not just empty data, but actual strings or arrays with a certain length of elements.


  2. Use the correct calling convention (C or stdcall). This is specified by the DLL and wrong convention can also result in a crash.

More information about calling DLLs can be found here:

Integrating DLLs

Writing Win32 Dynamic Link Libraries (DLLs) and Calling Them from LabVIEW

Have fun!
- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
0 Kudos
Message 2 of 2
(2,260 Views)