LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Crash when calling dlll built by LV using timed loop.

I have built a dll with Labview 7.1. Then I use VC++ 6.0 to call this dll. Everything is fine except that it will crash after the whole program finishes.  Without timed loop the program can exit normally. When built to exe file, it can also run normally. This happens in both Windows2000 and Windows XP.
Anyone knows the reason for this?
Thanks!
 
 
 
0 Kudos
Message 1 of 6
(2,486 Views)
I think I found the possible reason for this problem.
The timed loop never stops when executed in exe or dll file.
I have some condition to stop the timed loop and it does stop when executed in Labview.
Does anybody know how to solve this problem?
Thanks
 
 
0 Kudos
Message 2 of 6
(2,483 Views)
What exactly is the condition for stopping? If it's just a front panel control, then you are going to have to change it so that it stops on some other condition such as number of iterations or a time value.
Message 3 of 6
(2,480 Views)
Thank you very much Dennis
Your reply is really helpful. I use iteration instead of my old condition to stop the loop and it works!
The condition to stop is that when the value read from hardware is larger than some value than stop. So you mean  I should try to change this condition to some how compare to the iteration? Ok I will try this tomorrow.
 
 
0 Kudos
Message 4 of 6
(2,470 Views)
Not necessarily but you want the while to loop to stop based on some condition that will actually happen. That's why I said make sure it doesn't require a front panel control to change (like a Boolean) in order to stop. If you know that the value read from the hardware will always going to be larger than the value you first set when calling the dll, then the while loop will eventually stop. If you aren't sure, then you want to stop the while loop with another condition. This could be some time value or exceeding a max number of iterations.
0 Kudos
Message 5 of 6
(2,464 Views)

Now the timed loop stops correctly everytime both in Labview environment and standalone exe. But when I call the dll version from C. The c program has no response after the program finishes.

I built another small vi without timed loop to dll and called it. The c program exit normally. What is the problem?

The period of timed loop is 50ms. Is it too short? I found from other post that maybe I should use while loop instead of timed loop. But i need very accurate controling of time.

Any suggestions?

Thanks!

 

 

0 Kudos
Message 6 of 6
(2,454 Views)