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?
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
MathWorks Support Team
il 12 Apr 2012
Modificato: MathWorks Support Team
il 28 Ott 2015
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.
Risposta accettata
MathWorks Support Team
il 28 Ott 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.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su C Shared Library Integration in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!