LabWindows™/CVI Error: "Undefined symbol..." When Using a DLL

Updated Dec 19, 2022

Reported In

Software

  • LabWindows/CVI

Issue Details

I am using a DLL in LabWindows/CVI, and when I build the project I get the following error: 

Undefined symbol '___ImageBase' referenced in "c:\program files (x86)\national instruments\cvi2015\bin\msvc\cvistart.lib".

Solution

The error above is a linker error indicating that the compiler can't find a definition for ImageBase. Since this only occurs when making a call into the DLL in the program, this suggests that the issue lies with the linker files (.lib files) for the DLLs being used. It is likely that the linker file was generated specifically for a different compiler and its definition of ImageBase (which is a special symbol created by the linker) and conflicts with LabWindows/CVI's definition in cvistart.lib

The best way to attempt to fix linker issues is to regenerate the import libraries. If you open the header for the DLL in LabWindows/CVI, you will find Options >> Generate DLL Import Library... which will allow you to target the DLL and generate a new .lib file. Once this has been completed, remove the old linker file, and replace it with the newly generated one.

One workaround is to reduce the debug level to the lowest one which will reduce some options but still have debug capabilities. This can be done by clicking on Options >> Build Options >> Debugging Level. Change the Debugging Level to No run-time checking.