[IDLE] CLUG : Cambridge LabVIEW User Group (UK)

cancel
Showing results for 
Search instead for 
Did you mean: 

Debugging DLL calls using Visual Studio

I mentioned at yesterday's CLUG that it is possible to attach the Visual Studio debugger to LabVIEW and step from LabVIEW in to your C/C++ DLL. (I guess it's possible with .Net assemblies too, but I've not tried)

This is useful for checking that the DLL is receiving the values that you think it should be and that you are using the right data types etc.

With your DLL source code compiled in DEBUG mode in VS, click "Tools | Attach to Process" and you will get the following dialog...

atop.PNG

As you can see, it shows all the processes running on your PC and I have highlighted LabVIEW. Once you have clicked attached, you should be able to add breakpoints in your DLL code that will be hit when called from LabVIEW.

You must, of course, ensure that LabVIEW is using the debug DLL you have just built and not a different version elsewhere on your PC. To check where a process has loaded a library from, I recommend using Process Explorer

http://download.cnet.com/Process-Explorer/3000-2094_4-10223605.html

It's been a while since I've done this, but I think that's all you need to know!

Robin

Message 1 of 2
(6,036 Views)

useful notice:

when you attaching to a process, check "Attach to:" field. In VS 2017 automatically it attaches to managed code (e.g. C# assemblies), if you want to debug native C/C++ dll, click Select and choose "Native code" from the list

0 Kudos
Message 2 of 2
(4,569 Views)