LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling Wrapper DLL gives weird symbols in function prototype name

Solved!
Go to solution

Hi all,


I am currently using a 3rd party DLL from SCANLABS to communicate with a galvonometer control card (SCANLABS Scanalone).


There two important functions, SCANalone4open() and SCANalone4close(), which are required for using the DLL. However, they are not able to be detected by the Call Library Function node (see screenshot1.jpg). Looking at the header file, it appears that these two functions were

not exported with the (stdcall) calling convention as the other functions (see screenshot2.jpg).


Thus, I am writing a wrapper function in C to call these two functions. I will then build this wrapper into a DLL and call it from LabVIEW.
I am using Visual C++ Express 2008 to create this wrapper. After building the wrapper DLL, I called it with the Call Library Function node. However, there were some weird symbols inserted into the wrapper function name (see screenshot3.jpg)

May I know what is the cause of this and is there a way to solve this? (btw I have also attached the VC++ project and files together with it)


Thanks alot.

Best regards,Victor

Download All
0 Kudos
Message 1 of 5
(3,207 Views)

The Visual C++ project files are attached in this zip file here... 🙂

0 Kudos
Message 2 of 5
(3,206 Views)
Solution
Accepted by VLg

just add extern "C" in function name declaration, like: extern "C" __declspec(dllexport) int function_name()

....

or use a DEF file

Message 3 of 5
(3,179 Views)

Thanks cosmin, adding the extern "C" declaration solves the problem. 🙂

0 Kudos
Message 4 of 5
(3,148 Views)

Note that this is also explained here, here, and here.

0 Kudos
Message 5 of 5
(3,136 Views)