01-15-2015 04:34 PM
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.
01-15-2015 05:38 PM
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++
01-16-2015 01:49 PM
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.