Загрузка .dll в Matlab вызывает проблемы типа не найден - PullRequest
0 голосов
/ 02 декабря 2011

Я надеялся поэкспериментировать с [этой изящной C ++ dll] [1] в Matlab, так как у меня есть некоторые существующие вещи Matlab, которые, я думаю, могли бы извлечь пользу из функциональности этой библиотеки.Однако всякий раз, когда я запускаю эту команду для загрузки библиотеки:

loadlibrary('d3d9Callback.lib','d3d9Callback.h')

, я получаю неприятное количество предупреждений о наличии типов, используемых в dll, и сумасшедшее количество синтаксических ошибок, очевидно вытекающих изнеизвестные типы.Вот начало предупреждений / ошибок:

   Warning: Warnings messages were produced while parsing.  Check the functions you
intend to use for correctness.  Warning text can be viewed using:
[notfound,warnings]=loadlibrary(...) 
> In loadlibrary at 360
Error loading library intermediate output follows.
The actual error is at the end of this output.
*********

Type 'intCONSTDWORDPtr' was not found.  Defaulting to type voidPtr.

Found on line 29 of input from line 28 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'HANDLE' was not found.  Defaulting to type error.

Found on line 29 of input from line 28 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'intCONSTDWORDPtr' was not found.  Defaulting to type voidPtr.

Found on line 30 of input from line 29 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'HANDLE' was not found.  Defaulting to type error.

Found on line 30 of input from line 29 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'D3DSURFACE_DESCPtr' was not found.  Defaulting to type voidPtr.

Found on line 35 of input from line 34 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'BitmapPtr' was not found.  Defaulting to type voidPtr.

Found on line 35 of input from line 34 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'HANDLE' was not found.  Defaulting to type error.

Found on line 35 of input from line 34 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'BufferLockDataPtr' was not found.  Defaulting to type voidPtr.

Found on line 36 of input from line 35 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'D3DVERTEXBUFFER_DESCPtr' was not found.  Defaulting to type voidPtr.

Found on line 36 of input from line 35 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'BufferLockDataPtr' was not found.  Defaulting to type voidPtr.

Found on line 37 of input from line 36 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'D3DINDEXBUFFER_DESCPtr' was not found.  Defaulting to type voidPtr.

Found on line 37 of input from line 36 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'HANDLE' was not found.  Defaulting to type error.

Found on line 39 of input from line 38 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'HANDLEPtr' was not found.  Defaulting to type voidPtr.

Found on line 44 of input from line 43 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'intCONSTD3DVIEWPORT9Ptr' was not found.  Defaulting to type voidPtr.

Found on line 46 of input from line 45 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'D3DTRANSFORMSTATETYPE' was not found.  Defaulting to type error.

Found on line 47 of input from line 46 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'intCONSTD3DMATRIXPtr' was not found.  Defaulting to type voidPtr.

Found on line 47 of input from line 46 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'D3DVERTEXELEMENT9Ptr' was not found.  Defaulting to type voidPtr.

Found on line 49 of input from line 48 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'HANDLE' was not found.  Defaulting to type error.

Found on line 51 of input from line 50 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'intCONSTD3DLIGHT9Ptr' was not found.  Defaulting to type voidPtr.

Found on line 54 of input from line 53 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'BOOL' was not found.  Defaulting to type error.

Found on line 55 of input from line 54 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'intCONSTD3DMATERIAL9Ptr' was not found.  Defaulting to type voidPtr.

Found on line 57 of input from line 56 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'D3DRENDERSTATETYPE' was not found.  Defaulting to type error.

Found on line 59 of input from line 58 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'D3DTEXTURESTAGESTATETYPE' was not found.  Defaulting to type error.

Found on line 60 of input from line 59 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'HANDLE' was not found.  Defaulting to type error.

Found on line 62 of input from line 61 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'HANDLE' was not found.  Defaulting to type error.

Found on line 64 of input from line 63 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'HANDLE' was not found.  Defaulting to type error.

Found on line 65 of input from line 64 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'intCONSTBOOLPtr' was not found.  Defaulting to type voidPtr.

Found on line 67 of input from line 66 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'intCONSTfloatPtr' was not found.  Defaulting to type voidPtr.

Found on line 68 of input from line 67 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'intCONSTUINTPtr' was not found.  Defaulting to type voidPtr.

Found on line 69 of input from line 68 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'intCONSTBOOLPtr' was not found.  Defaulting to type voidPtr.

Found on line 71 of input from line 70 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'intCONSTfloatPtr' was not found.  Defaulting to type voidPtr.

Found on line 72 of input from line 71 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'intCONSTUINTPtr' was not found.  Defaulting to type voidPtr.

Found on line 73 of input from line 72 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'HANDLE' was not found.  Defaulting to type error.

Found on line 75 of input from line 74 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'D3DPRIMITIVETYPE' was not found.  Defaulting to type error.

Found on line 80 of input from line 79 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'D3DPRIMITIVETYPE' was not found.  Defaulting to type error.

Found on line 81 of input from line 80 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'D3DPRIMITIVETYPE' was not found.  Defaulting to type error.

Found on line 82 of input from line 81 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'INT' was not found.  Defaulting to type error.

Found on line 82 of input from line 81 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'D3DPRIMITIVETYPE' was not found.  Defaulting to type error.

Found on line 83 of input from line 82 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'intCONSTvoidPtr' was not found.  Defaulting to type voidPtr.

Found on line 83 of input from line 82 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'D3DPRIMITIVETYPE' was not found.  Defaulting to type error.

Found on line 84 of input from line 83 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'intCONSTvoidPtr' was not found.  Defaulting to type voidPtr.

Found on line 84 of input from line 83 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'D3DFORMAT' was not found.  Defaulting to type error.

Found on line 84 of input from line 83 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'intCONSTvoidPtr' was not found.  Defaulting to type voidPtr.

Found on line 84 of input from line 83 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'intCONSTRECTPtr' was not found.  Defaulting to type voidPtr.

Found on line 89 of input from line 88 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'intCONSTRECTPtr' was not found.  Defaulting to type voidPtr.

Found on line 89 of input from line 88 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'intCONSTD3DRECTPtr' was not found.  Defaulting to type voidPtr.

Found on line 90 of input from line 89 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Type 'D3DCOLOR' was not found.  Defaulting to type error.

Found on line 90 of input from line 89 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h

Failed to parse type 'D3D9Base :: LPDIRECT3DDEVICE9 Device' original input 'D3D9Base :: LPDIRECT3DDEVICE9 Device '
Found on line 101 of input from line 100 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h
Error parsing argument for function ReportCreateDevice function may be invalid.

Type 'ID3D9DeviceOverlayPtr' was not found.  Defaulting to type voidPtr.

Found on line 101 of input from line 100 of file C:\\Users\\Steven\\Dropbox\\Stanford_SC2bot\\D3D9CallbackSC2\\Base\\d3d9Callback.h
*********
??? Error using ==> loadlibrary at 441
Building d3d9Callback_thunk_pcwin64 failed.  Compiler output is:
cl -I"C:\Program Files\MATLAB\R2011a\extern\include"  /Zp8  /W3  /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0  /nologo  -I"C:\Users\Steven\Dropbox"
-I"C:\Users\Steven\Dropbox\Stanford_SC2bot\D3D9CallbackSC2\Base" "d3d9Callback_thunk_pcwin64.c" -LD -Fe"d3d9Callback_thunk_pcwin64.dll"
d3d9Callback_thunk_pcwin64.c
C:\Users\Steven\Dropbox\Stanford_SC2bot\D3D9CallbackSC2\Base\d3d9Callback.h(28) : error C2146: syntax error : missing ')' before identifier 'DWORD'
C:\Users\Steven\Dropbox\Stanford_SC2bot\D3D9CallbackSC2\Base\d3d9Callback.h(28) : error C2061: syntax error : identifier 'DWORD'
C:\Users\Steven\Dropbox\Stanford_SC2bot\D3D9CallbackSC2\Base\d3d9Callback.h(28) : error C2059: syntax error : ';'

Теперь я проверил форумы Matlab и попробовал обычных подозреваемых (установив компилятор c ++, убедившись, что это не 64-битная dll на 32-битном Matlab,и убедившись, что dll 'extern c').Я начинаю думать, что проблема в том, что проблема в том, что dll в значительной степени опирается на библиотеки Directx, а также на дополнительные dll с того же сайта.Возможно, Matlab не знает о них, и это вызывает проблемы типа неизвестных?Это единственное, о чем я могу думать, но для меня это не имеет смысла, так как загружаемая библиотека уже скомпилирована в dll.

В любом случае, я довольно новичок в работе с dll, поэтомумоя интуиция может быть далекоЛюбые мысли о том, почему Matlab не может распознать типы и как я мог бы решить проблему?

1 Ответ

1 голос
/ 02 декабря 2011

Из этого обсуждения ! в SO похоже, что экспортированные функции dll - это функции C, а не функции C ++ для loadLibrary в matlab.

Также в конце сообщения об ошибке, кажется, другая dll (d3d9Callback_thunk_pcwin64.dll), и отсутствуют некоторые включаемые файлы, таким образом, ошибка компилятора. Убедитесь, что библиотека, загружаемая в matlab, имеет зависимые dll, доступные для пути поиска matlab.

Обновление

Прочитав комментарий на форуме matlab ! Чтобы понять, куда идет d3d9Callback_thunk_pcwin64, это немного странно, так как вы упомянули, что подтвердили совместимость 64-битных dll и 32-битных matlab.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...