From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

laview dll

I am creating one labview DLL in LV 2015 then I am calling that DLL in Visual studio C++ 2012.

I need to debug that DLL.

There is any way to debug that LabVIEW DLL in VS.

Strictly I need to use VS only

 

0 Kudos
Message 1 of 7
(2,473 Views)

Of course!

 

Easiest is to add the LabVIEW executable as target executable in the debug configuration of your Visual C++ project. Then launch the executable from within VS by starting your project. Once LabVIEW has started and before you run the VI that calls your DLL, set the breakpoints in your code.

 

If you do not reference from your LabVIEW VIs the actual debug DLL in the build location that Visual C++ created but instead a more VI development friendly location you always must make sure to copy the built debug DLL into the location that your VIs reference it from and in order to do that you need to close LabVIEW as you can't replace a DLL that is open in a process.

If the DLL that the VI loads doesn't match the exact compilation in your project that your code contains at that moment you will not get to do source code debugging but instead at most land in the assembly code.

 

Rolf Kalbermatter
My Blog
Message 2 of 7
(2,428 Views)

Hi

I did the following operation.

1.I created one labview dll.

2.Then I Add that dll in visual studio project.

3.In Visual studio project I changed the target path as "C:\Program Files (x86)\National Instruments\LabVIEW 2015\labview.exe" in debug mode

4.then I Run VS++ project.

then "No debugging information dialog" pop-up came.

 

 

0 Kudos
Message 3 of 7
(2,399 Views)

That's expected as the LabVIEW exe does not contain debug information and is not supposed to contain that. Just confirm this dialog with yes.

 

And you should not generate a new project to add your dll to, but instead add your step 3. to the project that you use to compile your DLL and in there to the debug configuration.

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 7
(2,395 Views)

I tried but disassembly is only opening.

could you explain step by step procedure

0 Kudos
Message 5 of 7
(2,378 Views)

So you have your DLL project. In there in the debug built configuration you add the LabVIEW executable as target executable to start for a debug session. Then compile the debug built.

 

Make sure to copy the resulting DLL from the build output folder to the directory where your VIs want to load it from.

 

Start your debug session from Visual Studio, LabVIEW starts up, load your VI that references the DLL and then proceed to set setpoints in the source code before starting the VI.

 

It is VERY important that any time you make any modification to the DLL that results in a recompile, to copy the resulting DLL into the location that the LabVIEW VI wants to load it from.

 

Visual C on starting the debug session will always check if there are any modifications in the project and force you to rebuild the DLL if there are and then when loading the DLL into the debug process it will check the DLL debug signature to match the EXACT signature for the last build. If they don't match (and that includes a rebuild that was caused by purely cosmetic edits to the source code without any logical change) the DLL is not considered the same, despite its same name and you will consequently land in the disassembly view since there is no source code to show for that DLL.

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 7
(2,371 Views)

I read your initial message again and realize that you create the DLL in LabVIEW and not in Visual Studio. In that case, no there is absolutely no way to debug it in Visual Studio only!

 

Visual Studio has absolutely no means to understand how a LabVIEW DLL is built. You will need to have LabVIEW installed and configured to debug the DLL by building the DLL in LabVIEW for debugging (which will avoid removing the diagram from the VIs) and then starting a LabVIEW debug session. The steps involved are like this (taken from here😞

 

  1. Before compiling the DLL, set Enable Debugging to true in the build specifications and set breakpoints near the beginning of any functions that you want to debug (or set Wait for debugger on launch to open all functions for debugging).
  2. Compile the DLL and move the DLL and all support files to the directory from which the DLL will be called (you can also build your project directly to the calling directory).
  3. From any LabVIEW project/application select Operate --> Debug Application or Shared Library...
  4. Run the program that calls your DLL (in my case this was TestStand)
  5. Push the Refresh button in the shared library debugger and you should be able to select your DLL from the list and debug
Rolf Kalbermatter
My Blog
0 Kudos
Message 7 of 7
(2,353 Views)