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: 

PDA: Calling library functions - seems to link the stubbed .cpp file instead of the DLL

I'm having trouble developing a Lab View PDA module that calls a DLL built using Visual C++. The DLL functions correctly when called in a non-PDA VI. My issues seem to be with porting to the PDA.

My configuration:

- Lab View 8.5 with the PDA 8.5 module

- Visual Studio 8.0 with the Windows Mobile 6.0 SDK

- ASUS 626 PDA with an Intel PXA70 procesor running Windows Mobile 6 Classic

 

Following the PPCBatt example code provided with the PDA module, I have:

- used extern "C" to prevent name mangling

- placed the DLL built with the Windows Mobile SDK in the \Windows directory on the PDA

- created a stub Win32 DLL and lib

- created a stubbed cpp file whose functions only return zero

- included the stubbed cpp and lib files in the build spec / source files / additional files

- placed Call Library Function nodes on my PDA VI, selected the function names, set the parameter types

- built and deployed the executable, both with and without debug

 

When I set the library path property of the Call Library Node, the functions appeared in the function name pulldown, but the parameters did not populate. I had to manually add them and set their types. The help page says they would autopopulate when the function was selected.

I've debugged the VI, and the Library Function Call nodes are being called. It seems the build is linking the code from the stub C file provided in the additional files portion of the source files property page, instead of adding hooks to call the DLL on the PDA. As a test, I changed an output parameter in one of the functions in the stubbed cpp file - the changed value showed in the front panel indicator.

What am I doing wrong?

Dan

0 Kudos
Message 1 of 3
(4,699 Views)
Hi Dan,

I'm not sure if I understood you problem fully. When calling external code with LabVIEW PDA, the DLL acts as a stub DLL with the correct function prototypes for the C code that you want to call. Here's a Knowledge Base article that might help explain about calling External Code in LabVIEW PDA.

Regards,
Stanley Hu
National Instruments
Applications Engineering
http://www.ni.com/support
0 Kudos
Message 2 of 3
(4,471 Views)

The problem was solved by removing the stubbed cpp file from the additional files.  Only a stub dll file is needed.  The build was linking the stubbed bodies in the cpp fie instead of calling the dll on the PDA.

When building a PDA application, if you get an error indicating a .c/.cpp file is missing, the external library call nodes are not configured to match the stub dll.

Message 3 of 3
(4,280 Views)