Why Do I Get Error Undefined Symbol '_RTmain' When Trying to Build My RT DLL?

Updated Jan 18, 2023

Reported In

Software

  • LabWindows/CVI Full

Issue Details

When I attempt to build my Real-Time DLL in LabWindows™/CVI™, I get errors about Multiple Defined or Undefined symbols. 


error: Multiply defined symbol '_StartupLibraryInit' in 'cvi.lib' and 'cvistart.lib'

error: Multiply defined symbol '_StartupLibraryCleanup' in 'cvi.lib' and 'cvistart.lib'

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

Solution

This error can be thrown when you use the RTIsShuttingDown() function without having an RTmain entry point defined in your DLL. RTIsShuttingDown is the only function that requires the RTmain entry point in order to run without error. 

Refer to the example code show below that can be found in the help documentation of the RTIsShuttingDown() function. 


void CVIFUNC_C RTmain (void)

{

if (InitCVIRTE (0, 0, 0) == 0)

return; /* out of memory */

/* your initialization code */

while (!RTIsShuttingDown ()

{

/* your code */

}

/* your cleanup code */

CloseCVIRTE ();

}