LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling to certain functions in a DLL causes a stall

I imported the dll and the header file and made it into a labview library. There were no errors in the output, but when I try to use certain VIs within the DLL, labview either crashes or freezes for a long time (at which I have to kill the process through Task Manager). For example, if I use the rtSelectDevice VI, it works properly and Labview doesn't crash. However, if I use rtAddCalibrationData, Labview crashes and I have to force it to close.

 

I have tried double checking the parameters of the function and I have also changed the calling and the threading (UI vs any).

 

Thanks

Download All
0 Kudos
Message 1 of 7
(2,665 Views)

You forgot to attach your VI for rtAddCalibrationData.

 

George Zou
0 Kudos
Message 2 of 7
(2,628 Views)
0 Kudos
Message 3 of 7
(2,617 Views)

If it's crashing you're doing something wrong. First candidate would be to switch the calling convention from std convention to winapi or visa versa.

 

If the calls are stalling, they are blocking the UI thread. So configure the call to run in any thread. This also means VI's can call functions in parallel, which might be something you want to avoid. If it is, the call doesn't force sequential execution so make sure the VI's will.

0 Kudos
Message 4 of 7
(2,615 Views)

Thank you for your response. I have tried the calling convention fix already and it does not work.

 

For your other solution, please elaborate what you mean by forcing sequential execution.

0 Kudos
Message 5 of 7
(2,605 Views)

@BombiniSlombini wrote:

Thank you for your response. I have tried the calling convention fix already and it does not work.


Must be doing something else wrong. Or the dll is just poorly made. Maybe you can set the error checking to maximum, and study the error?

 


For your other solution, please elaborate what you mean by forcing sequential execution.


If you can run the dll in any thread, all calls to the dll will happen in parallel (concurrently) if you make the calls in parallel in LabVIEW. Not all dll's can handle that, for instance when calls use shared resources. So you need to make sure you don't do that.

0 Kudos
Message 6 of 7
(2,599 Views)

I didn't find anything wrong in your VI.

rtAddCalibrationData is a simple dll call.

It takes a filename as a string; and returns a long; should be stdcall as indicated in the header file.

 

You should check the doc for the dll to see if there any requirement for the call.

e.g. if the specified path doesn't exist, what would happen?

or if the file format is incorrect, etc.

 

George Zou
0 Kudos
Message 7 of 7
(2,587 Views)