【发布时间】:2014-08-06 18:23:17
【问题描述】:
我正在尝试使用 loadlibrary() 将 C++ API(用于 SignalHound.com 上的 BB60C 收音机)加载到 Matlab 中,但它仅适用于 32 位 Matlab (R2014a)。 zip 文件here 包含 bb_api.h 头文件,并在其各自的文件夹中同时具有 32 位和 64 位 bb_api.dll。为了运行它,我将正确的 .dll 复制到带有 bb_api.h 的文件夹中并调用 loadlibrary('bb_api','bb_api.h')。虽然这适用于 32 位版本,但当我在 64 位 Matlab 中使用 64 位 .dll 时,出现以下错误:
Error using loadlibrary (line 422)
Building bb_api_thunk_pcwin64 failed. Compiler output is:
cl -I"C:\Program Files\MATLAB\R2014a\extern\include" /W3 /nologo /D_CRT_SECURE_NO_DEPRECATE
/D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 -I"C:\Program Files\MATLAB\R2014a\extern\include" -I"C:\Program
Files\MATLAB\R2014a\simulink\include" -I"C:\Users\mimhof\Documents\GitHub\SDR\Matlab"
-I"C:\Users\mimhof\Documents\GitHub\SDR\Matlab" "bb_api_thunk_pcwin64.c" -LD -Fe"bb_api_thunk_pcwin64.dll"
bb_api_thunk_pcwin64.c
C:\Users\mimhof\Documents\GitHub\SDR\Matlab\bb_api.h(202) : error C2061: syntax error : identifier 'bbOpenDevice'
C:\Users\mimhof\Documents\GitHub\SDR\Matlab\bb_api.h(202) : error C2059: syntax error : ';'
C:\Users\mimhof\Documents\GitHub\SDR\Matlab\bb_api.h(202) : error C2059: syntax error : 'type'
C:\Users\mimhof\Documents\GitHub\SDR\Matlab\bb_api.h(203) : error C2061: syntax error : identifier 'bbCloseDevice'
C:\Users\mimhof\Documents\GitHub\SDR\Matlab\bb_api.h(203) : error C2059: syntax error : ';'
C:\Users\mimhof\Documents\GitHub\SDR\Matlab\bb_api.h(203) : error C2059: syntax error : 'type'`
API 中可用的所有方法等等。什么会导致此错误发生在 64 位而不是 32 位?
谢谢!
【问题讨论】:
-
我联系了 Mathworks,显然要在 64 位 Matlab 中运行它,需要一个与 API 关联的 thunk 文件(其中没有 32 位 thunk 文件的概念),它充当兼容层。
标签: c++ matlab dll loadlibrary