LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dll call with timeout

I am using a DLL to communicate with a device (spectrometer to be exact).

The device can be a bit unreliable and occasionally freezes while the DLL is running.

 

My question is: how can I enable a DLL call to timeout after a limit is reached?

 

(This would also give me the ability to abort a test without having to wait for the device to return the last measurement)

 

I've considered using VI server to make an asynchronous call to the VI that calls the DLL and stopping the execution of that VI if it times out but I was hoping there was a simpler solution.  Thanks in advance.

0 Kudos
Message 1 of 6
(3,613 Views)

There is no way to abort a DLL call without killing the VI that makes the call, so the VI server approach may be necessary if you can't fix the DLL.  I did something somewhat like this to handle an unstable ActiveX component and it worked well, although in that case the problem was that the ActiveX component tended to crash on its own and I didn't want it to take out my entire application.

0 Kudos
Message 2 of 6
(3,610 Views)

Yea, basically the DLL tends to freeze sometimes which freezes the entire application.

0 Kudos
Message 3 of 6
(3,607 Views)

Hi GollumGTH,

 

The VI Server option seems to be appropriate, as there doesn't seem to be any efficient way to accomplish this task. You can refer to this forum post where other customers were encountering the same issue. 

 

http://forums.ni.com/t5/LabVIEW/Call-Library-Function-node-timeout/m-p/427324

 

I hope this information helps. 

 

Regards,

James D.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 6
(3,580 Views)

 I've made somewhat of a workaround; using the Application Control functions, I use my main VI to run a separate VI (make sure Wait Until Done is false). The main via writes some data to a file, starts the new VI (which runs the DLL function), and waits for 3 seconds for a response file to be written. If it doesn't find the response file within that time, it force closes the separate VI. There's probably a better way to communicate data from one VI to another, but writing files was easy for me to whip together.

Message 5 of 6
(3,018 Views)

Hi SirLogan,

 

Thanks for posting on the forums! I see that the original post was made in 2012, so if you wanted to get more visibility for your workaround, you might consider creating a new forum post.  

 

Thanks!

Erika
Technical Support Engineer
National Instruments
0 Kudos
Message 6 of 6
(3,004 Views)