10-25-2017 08:13 AM
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
10-25-2017 04:07 PM
You forgot to attach your VI for rtAddCalibrationData.
10-26-2017 06:19 AM
Here u go
10-26-2017 06:26 AM
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.
10-26-2017 08:24 AM
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.
10-26-2017 08:40 AM
@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.
10-27-2017 10:11 AM
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.