11-20-2014 10:56 AM
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...
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
03-26-2018 03:51 AM
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