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 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2012년 4월 12일
편집: MathWorks Support Team
2015년 10월 28일
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.
채택된 답변
MathWorks Support Team
2015년 10월 28일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 C Shared Library Integration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!