LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to debug dll source code (c++) when calling dll with Labview

I have dll-s written in C++. I use IDE Visual Studio.

 

When I call dll-s from Labview it is possible Labview to crash because some bugs in dll source code. 

 

Is it possible to somehow link Visual Studio and Labview and be able to debug c++ source code?

0 Kudos
Message 1 of 3
(2,330 Views)

Hi Skoda3,

 

Could you please check the forum thread linked below and let me know if it answers your question

 

https://forums.ni.com/t5/LabVIEW/Debugging-a-c-dll-from-visual-studio-2010/td-p/2346918 

 

M.

---
CLA,CTD,CLED
0 Kudos
Message 2 of 3
(2,286 Views)

The link doesn't work for some reasons but yes it is possible. Basically you setup the debug build of your DLL, then select to start the debug session from within the Visual C IDE, with the path to the according LabVIEW.exe as the debug executable.

 

The Visual C will startup LabVIEW and from there you can simply load the VIs that reference your DLL. When you then set breakpoints in your code before you start the LabVIEW VI, the Visual C IDE will break at the breakpoints as soon as the code runs into it.

 

Another option is to compile a debug version on your DLL that contains at strategic points an  __asm__("int3") breakpoint (use the Visual C intrinsic __debugbreak() instead to be compatible with 64-bit commpilation). This will cause an exception and offer you to start the Visual C IDE for debugging, but this is less reliable and requires that the source code is exactly at the place where it was when the DLL was compiled.

 

I really prefer the first variant, eventhough it requires you to restart LabVIEW from within Visual C for each debug session.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 3
(2,275 Views)