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!