LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview silent crash when closing vi calling dll

Solved!
Go to solution

Hi 

 

I'm calling a third party DLL from labview, and this works perfekt, only thing is when i close the vi using the DLL, the complete labview eviroment makes a silent crash, it just shut down all my open vi´s and the complete Labview enviroment. How can i debug this issue, is there any crash log for labview, or is there any way to solve the problem or make a workaround for it ?

0 Kudos
Message 1 of 8
(1,596 Views)

Hi Efri,

 


@Efrihauge wrote:

I'm calling a third party DLL from labview, and this works perfekt, only thing is when i close the vi using the DLL, the complete labview eviroment makes a silent crash


Apparently "this works NOT perfect" when your VI/IDE/EXE crashes.

Are you sure you are calling that 3rd party DLL correctly?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO
0 Kudos
Message 2 of 8
(1,578 Views)

Hi GerdW

 

Yes I'm sure, I have now tried to call the dll from a C++ compiler, and the same issue is there, when the program exit, it got an exception. 

Is there any way to make a workaround, I mean it looks drastic that labview terminate because of an exception from a dll call.

Is there any way to handle this from labview. ?

 

Br

Esben

 

 

0 Kudos
Message 3 of 8
(1,571 Views)

Hi Efri,

 


@Efrihauge wrote:

Yes I'm sure, I have now tried to call the dll from a C++ compiler, and the same issue is there, when the program exit, it got an exception. 

Is there any way to make a workaround, I mean it looks drastic that labview terminate because of an exception from a dll call.

Is there any way to handle this from labview. ? 


I don't think so, but I'm not an expert with DLLs. Wait for RolfK to chime in…

 

Why does it "look drastic" when an EXE crashes upon errors in DLL calls? You should rather avoid those exceptions at all, independently from the caller environment!

Either there is a bug in the DLL or you call it with wrong parameters: what does the creator of that DLL say about this problem?

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO
0 Kudos
Message 4 of 8
(1,567 Views)

Hi GerdW

 

The creator know there is an error when the dll is unloaded it throw an execption. 

But he haven't time yet to solve it and just ask me to make a workaround. 

But there seems not to be any way to handle theese kind of errors in labview, right?

 

Br

Esben

0 Kudos
Message 5 of 8
(1,562 Views)
Solution
Accepted by topic author Efrihauge

If LabVIEW simply crashes there is a very serious bug either in the configuration/implementation of the Call Library Node or in the DLL itself. It means that the DLL somehow destroyed memory or tried to access memory that is not valid. After such a grave violation there simply is no safe way to continue and Windows simply terminates the process. Even if there was a way to prevent Windows from doing that, it would only lead from bad to worse whatever you try to do after that. Basically the integrity of your process was violated and continuing after that would almost certainly just destroy even more and lead nowhere useful.

 

If your developer confirms that there is a problem in the DLL, you will have to wait for him to fix it or tell you how to avoid it. Avoiding it almost certainly will consist of not calling the offending API or at least only with parameters that don't trigger the bug. But that is something that developer needs to be able to tell you, nobody else can as we don't know the DLL in question and certainly not the internal details about it!

 

If the error is really only happening at DLL unload, one possible workaround is to prevent the DLL from unloading. However that comes with other possible problems such as having to restart LabVIEW altogether anyhow as soon as you want to change, move, rename or delete the DLL on disk. A loaded DLL causes Windows to lock its file and any attempt to change that file in any way is blocked. The easist way to prevent the DLL from unloading is to keep somewhere in your LabVIEW a VI open that contains a Call Library Node referencing that DLL. Don't ever close that VI or the top level VI that calls this VI. This way the Call Library Node will keep the DLL loaded!

Rolf Kalbermatter
Averna BV
Message 6 of 8
(1,525 Views)

@Efrihauge wrote:

Hi GerdW

 

The creator know there is an error when the dll is unloaded it throw an execption. 

But he haven't time yet to solve it and just ask me to make a workaround. 

But there seems not to be any way to handle theese kind of errors in labview, right?

 

Br

Esben


If the creator doesn't have time to fix such an egregious bug, then you probably don't have time to use it.  That's like buying a car from a dealer, complaining that you can't stop the engine unless you disconnect the alternator and the battery, and the dealer telling you he doesn't have time to fix it; find a way to work around it, instead.

 

Maybe you should tell his boss that he doesn't have time to fix a bug that renders his dll unusable.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 8
(1,499 Views)

OK 

 

Looks like a way for me to continue until the DLL is fixed.

 

Thank you 

 

Br

Esben

0 Kudos
Message 8 of 8
(1,447 Views)