Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

NI 488.2 static linking

Hello,

 

It seems there is a problem with using the /MT (static link) option when compiling programs using NI488.2. The /MD (dynamic link) option works fine.

The issue is even present when compiling standard example scripts, such as "FindInstruments.c" 

The error messages during compilation are:

1>ni4882.obj : error LNK2019: unresolved external symbol __imp__fread referenced in function _LoadFunction@4
1>ni4882.obj : error LNK2019: unresolved external symbol __imp__fopen referenced in function _LoadFunction@4
1>ni4882.obj : error LNK2019: unresolved external symbol __imp__strncat referenced in function _LoadFunction@4
1>ni4882.obj : error LNK2019: unresolved external symbol __imp__rand referenced in function _LoadFunction@4
1>ni4882.obj : error LNK2019: unresolved external symbol __imp__srand referenced in function _LoadFunction@4
1>ni4882.obj : error LNK2019: unresolved external symbol __imp__time referenced in function _LoadFunction@4

 

There is no problem compiling with /MD.

 

Here are some old threads I found on the topic with no resolution for using static linking, the only "solution" is to use dynamic linking. But many applications (including mine) require static linking...

 

https://forums.ni.com/t5/Measurement-Studio-for-VC/NI4882-OBJ-needed-for-static-MSVC-linkage/td-p/17...

https://forums.ni.com/t5/Instrument-Control-GPIB-Serial/Unresolved-external-symbols-when-linking-C-w...

https://forums.ni.com/t5/Instrument-Control-GPIB-Serial/Linker-error-VC-2008/td-p/1045477

https://social.msdn.microsoft.com/Forums/vstudio/en-US/33d20497-d7c1-4b02-bc99-3bd933d57a3e/ni4882-l...

 

Has anybody got it to work using 488.2 libraries with static linking?

0 Kudos
Message 1 of 1
(3,361 Views)