MATLAB Answers

0

Why do I get an error when I try to use LOADLIBRARY to load a DLL on 64-bit MATLAB when the 32-bit version used to work on 32-bit MATLAB?

I have a 64-bit DLL, visa64.dll, which gives me the below errors when I try to load it in 64-bit MATLAB 7.13 (R2011b).
 
***** Error using loadlibrary (line 421) Building nivisa_thunk_pcwin64 failed. Compiler output is: cl -I"C:\Program Files\MATLAB\R2011b\extern\include" /W3 /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /nologo -I"C:\Windows\system32" -I"C:\Program Files (x86)\IVI Foundation\VISA\WinNT\include" "nivisa_thunk_pcwin64.c" -LD -Fe"nivisa_thunk_pcwin64.dll" nivisa_thunk_pcwin64.c nivisa_thunk_pcwin64.c(56) : error C2143: syntax error : missing ')' before '*'
The above is just a partial section. The actual errors have many more but similar lines.
I know the visa64.dll has no problems as it works outside of MATLAB, not to mention that the 32-bit version, visa.dll, loads fine into 32-bit MATLAB.

1 Answer

Answer by MathWorks Support Team on 28 Oct 2015
 Accepted Answer

This error occurs because on 64-bit Windows, VISA driver header files will contain the __fastcall keyword in function signatures which "loadlibrary" is unable to deal with.
To workaround this, edit the DLL's accompanying header file, visa.h, so that the __fastcall definitions are removed. To do this easily, just add
#define __fastcall
at the top of the header file, which instructs the compiler to define __fastcall as nothing.

  0 Comments

Sign in to comment.