LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview 8.5.1 crashes on stop / abort execution

So this question is kind of a continuation of my last post: http://forums.ni.com/ni/board/message?board.id=170&message.id=428065#M428065

 

I'm having a problem with labview crashing when I stop a VI. My program uses two .dlls. One written by Amptek to interface with a spectrometer of theirs and one written by me to create a structure (definied in the link above), get memory space for it  (using malloc) and send a pointer from it to some functions in the amptek .dll. There are three events in my VI. One 'start' that opens USB communications with the spectrometer and sets a configuration; one 'test' that initializes an instance of this structure, puts some values into it, and then gives a pointer to this structure instance to the Amptek functions; and one 're-read configuration' (using functions from the amptek .dll) that sees if the values I put into the struct have ben recognized and recorded by the spectrometer. I've tried three different ways to stop the program: 1) the abort button 2) a 'stop' event -- value change from a stop button that then goes to the loop stop terminal 3) a 'stop' button in the main loop attached directly to the loop stop terminal. And for all three of them I get a pop-up message " LabVIEW 8.5.1 Development System has encountered a problem and needs to close.  We are sorry for the inconvenience." 

 

I think the crash only occurs after I've run the 'test' part of my program, which is where all the stuff from my .dll is used. So it looks as if there's some problem that I've created by using my own .dll. 

 

I've attached the code for my .dll (which I compiled using minGW gcc) and the header. and the program that crashes.

 

Any suggestions would be greatly apprecaited. I'm out of ideas...

Download All
0 Kudos
Message 1 of 8
(3,748 Views)
oh right. I should probably mention that I occasionally get an error 1097 from one of the 'destroy' call library function nodes, whose purpose is to free the memory for my struct created earlier. but I can run the events 'test' and 're-read configuration' repeatedly without a crash, even changing some of the values I write to the struct -- the crash only happens when I try and stop the VI.
0 Kudos
Message 2 of 8
(3,747 Views)
Hey, this code is huge.  Can you use highlight execution to narrow down exactly where the problem is encountered?
Chris Bakker
SET Americas
CEO

0 Kudos
Message 3 of 8
(3,719 Views)

I've used highlight execution, but since the problem happens on 'stop' or 'close' I can't watch the execution to find the error. Like I said above I somtimes get an error 1097 from the 'test' part of the program, but that doesn't crash labVIEW.

 

This was probably unhelpful -- sorry.... But thanks for answering my post.

0 Kudos
Message 4 of 8
(3,705 Views)

Hi check out this KB.  It specifically adresses an issue where LabVIEW doesn't crash until the .dll is closed.

 

Why Does LabVIEW Crash When I Call My DLL?

 

Chris Bakker
SET Americas
CEO

0 Kudos
Message 5 of 8
(3,684 Views)
Thanks again for the post. Unfortuantely I've already looked at that page, which lead to me to believe that I have memory corruption issue, but didn't really offer any solutions. Does anyone know of a way to investigate memory corruption errors? Maybe something that can be run through a windows terminal?
0 Kudos
Message 6 of 8
(3,658 Views)

Not sure if debugview will assist your efforts, but it helped me nail down issues with dll's in the past.

 

http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx

 

-AK2DM

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 7 of 8
(3,652 Views)
Thanks a bunch for the DebugView link, DigitalMan; I'll give it a shot.
0 Kudos
Message 8 of 8
(3,647 Views)