LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I debug the Call Library Function at run-time

I've written a VI using the CLF to call a DLL which was compiled off-site by another engineer using MSVC. Even though the VI runs without flagging any errors, the VI is not doing what I expect. Is there any way of finding out if the DLL is been called correctly? The first function that is called doesn't return any value, but I think that it should. Does this mean that the DLL is not being called correctly? Note also that the DLL works fine with a JAVA GUI.
0 Kudos
Message 1 of 4
(2,611 Views)
Make sure that you are specifying the proper function prototype in the call library function. If you are slightly off the call will not work properly. Ask the offsite engineer to provide you with this data. Another tip is to build the dll with the option to show front panel when called. You can actually popup the dll like you would a subvi. If you design it with test indicators showing on the front panel that is a great way to determine if it is working. Hope this helps.
BJD1613

Lead Test Tools Development Engineer

Philips Respironics

Certified LV Architect / Instructor
0 Kudos
Message 2 of 4
(2,611 Views)
Thanks for the quick reply. The function prototype issue is something I'm worried about. The first time I call the DLL, the particular function expects a pointer to the first character of a NULL terminated C string. I've configured this as a CStr Pointer in the CLF. Is ths correct? In C code the function is "HRESULT pll_open(const char* port)"If so, what about the NULL character: does Labview automatically add this or should I add code to do this myself? (The string to be passed is "lpt1").

Another point: I've used Dependency Walker (as recommended on the NI website) to view the VI, and gotten the error message "No DOS or PE signature found. This file is not a valid 32-bit or 64-bit windows module". Any idea what this means?
0 Kudos
Message 3 of 4
(2,611 Views)
If you have the code for the dll, you can launch LV thru MSVC ( Project Settings >> Debug ,and set the executable to LV ). Then hit f5, and MSVC will launch LabVIEW. Run the VI that calls the dll, and MSVC should break wherever you set a breakpoint. This will need to be a debuggable project. This way, you can follow the code in the dll as it is being run from LV.


Hope ths helps

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 4 of 4
(2,611 Views)