LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

application builder static lib visual c++

I am trying to compile a Labview VI into a library (DLL or LIB) which can then be used by external applications.  I am able to do this just fine, and can access the DLL in Python. 

 

However I am haivg trouble getting this to work in C++, particularly Visual C++.  It will compile fine, but when I get to the link stage, it gives me an unresolved external symbol error.   I have included the .lib in the linker options and the set the library path properly.   For instance, in the header file I have the following function. 

 

double __cdecl LVDLLTest(double a, double b);

 

And in my .cpp code I have the following line:

 

double c = LVDLLTest(2, 3);

 

Compiling this will result in the errror:

 

Error 3 error LNK1120: 1 unresolved externals c:\Users\OHNS\Documents\Visual Studio 2012\Projects\OCT_LabVIEW_FPGA_Interface\Debug\OCT_LabVIEW_FPGA_Interface.exe OCT_LabVIEW_FPGA_Interface


Error 2 error LNK2019: unresolved external symbol _LVDLLTest referenced in function "int __cdecl InitInstance(struct HINSTANCE__ *,int)" (?InitInstance@@YAHPAUHINSTANCE__@@H@Z) c:\Users\OHNS\Documents\Visual Studio 2012\Projects\OCT_LabVIEW_FPGA_Interface\OCT_LabVIEW_FPGA_Interface\OCT_LabVIEW_FPGA_Interface.obj OCT_LabVIEW_FPGA_Interface

 

Any ideas?  Thanks.

0 Kudos
Message 1 of 3
(2,769 Views)

Okay this is apparently a 64-bit/32-bit issue.  I was building the library in 64-bit LabVIEW, but compiling to a 32-bit target in VC++.

 

I used a 32-bit verison of LabVIEW to compile the lib and it worked.   Now I will figure out how to target 64-bit platforms in VC++

 

 

 

0 Kudos
Message 2 of 3
(2,754 Views)

Hi PatrickR,

 

Have you had a chance to check out this webpage?

 

http://msdn.microsoft.com/en-us/library/h2k70f3s.aspx

 

There are differences in the way integers are displayed as well as 32 bit vs 64 bit pointers.

Justin M.
Applications Engineering
National Instruments
0 Kudos
Message 3 of 3
(2,719 Views)