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?

7 views (last 30 days)
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.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 28 Oct 2015
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.

More Answers (0)

Categories

Find more on Application Deployment in Help Center and File Exchange

Products


Release

R2011b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!