Hi
I tried to add VISA support on a small program on Windows 10, compiled with mingw (C++). But I have a problem with the linker who failed to link all the functions(error undefined reference to `LeaveCriticalSection@4')
My code (simplified)
#include "C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Include\visa. ..... ViSession defaultRM; ViStatus status = viOpenDefaultRM(&defaultRM); if (status == VI_SUCCESS) { status = viOpen(defaultRM, "GPIB0::2::INSTR", VI_NULL, VI_NULL, &instr); } .....
The makefile
CXXFLAGS += -I/C/Progra~2/IVI~1/VISA/WinNT/Include LDLIBS += -L/C/Windows/System32 -lvisa32
The error message:
g++.exe -Wall -g -I/C/bin -I/C/Progra~2/IVI~1/VISA/WinNT/Include -shared -o libUserCode.dll nivisa.o prologix.o qpx1200sp.o usercode.o -L/C/MuTest/bin -lmttnative -lDSP_Library -L/C/Windows/System32 -lvisa32 Warning: resolving _GetModuleHandleA@4 by linking to _GetModuleHandleA Use --enable-stdcall-fixup to disable these warnings Use --disable-stdcall-fixup to disable these fixups Warning: resolving _GetProcAddress@8 by linking to _GetProcAddress Warning: resolving _viOpenDefaultRM@4 by linking to _viOpenDefaultRM Warning: resolving _viOpen@20 by linking to _viOpen Warning: resolving _viClose@4 by linking to _viClose Warning: resolving _Sleep@4 by linking to _Sleep Warning: resolving _VirtualQuery@12 by linking to _VirtualQuery Warning: resolving _VirtualProtect@16 by linking to _VirtualProtect Warning: resolving _EnterCriticalSection@4 by linking to _EnterCriticalSection Warning: resolving _TlsGetValue@4 by linking to _TlsGetValue Warning: resolving _GetLastError@0 by linking to _GetLastError Warning: resolving _DeleteCriticalSection@4 by linking to _DeleteCriticalSection Warning: resolving _InitializeCriticalSection@4 by linking to _InitializeCriticalSection c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libmingw32.a(tlsthrd.o): In function `_mingwthr_run_key_dtors': C:\MinGW\msys\1.0\src\mingwrt/../mingw/tlsthrd.c:117: undefined reference to `LeaveCriticalSection@4' c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libmingw32.a(tlsthrd.o): In function `__w64_mingwthr_add_key_dtor': C:\MinGW\msys\1.0\src\mingwrt/../mingw/tlsthrd.c:59: undefined reference to `LeaveCriticalSection@4' c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libmingw32.a(tlsthrd.o): In function `__w64_mingwthr_remove_key_dtor': C:\MinGW\msys\1.0\src\mingwrt/../mingw/tlsthrd.c:93: undefined reference to `LeaveCriticalSection@4' C:\MinGW\msys\1.0\src\mingwrt/../mingw/tlsthrd.c:93: undefined reference to `LeaveCriticalSection@4' collect2: ld returned 1 exit status make: *** [libUserCode.dll] Error 1
Several functions was linked, but not all.
Any ideas ?
Thanks in advance