LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error occurs when exiting VI

In my application. just call C DLL. it works fine until I notice that when I exit LabVIEW. there are several error message pop up.
says wrong memory reference at "xxxxxxx". It's not a random error, it's pretty consistent.
I am sure it related with the DLL. in my DLL, there are some threads. when I start VI application DLL was load and threads is running. when I press stop button in my VI application, the threads in DLL were not killed. When I exit the VI then it try to retrieve DLL resource, that causes the problem. I winder is there anyone has the same experience as me, and how to solve it?

Thanks in advance.

rluo
0 Kudos
Message 1 of 3
(2,273 Views)
Hi Rluo,

It sounds very reasonable that your errors are caused by threads that haven't been properly closed. Therefore, always make sure not to stop your VI using the 'Abort' button, since this can end the execution within a DLL call without cleaning up/closing open references. Instead, use a stop button to end your VI gracefully. If necessary, use an additional DLL call to clear all references/threads just before stopping the VI.

Have fun!

Message Edited by Philip C. on 04-26-2005 11:07 PM

- Philip Courtois, Thinkbot Solutions

Thinkbot Solutions
0 Kudos
Message 2 of 3
(2,253 Views)
Hi, Philip,
I did use stop button rather than abort the application. And I noticed that the threads are not stopped after the application stopped. As you suggested, maybe I should export killThreads() function in DLL, and VI call it before stop.
I think you are an expert in VI.
Thank you.
0 Kudos
Message 3 of 3
(2,237 Views)