error using loadlibrary on delcom.dll/.h - any idea why this is not working?

5 ビュー (過去 30 日間)
dave
dave 2018 年 11 月 1 日
コメント済み: dave 2018 年 11 月 2 日
I am trying to communicate with a delcom USB product. I downloaded the .dll and the .h from their website: https://www.delcomproducts.com/productdetails.asp?ProductNum=890510
I downloaded the zip file and renamed the files for convenience to delcom.dll and delcom.h
issued:
loadlibrary('delcom.dll','delcom.h'
i get over 100 errors that look similar to this:
Error using loadlibrary
Building delcom_thunk_pcwin64 failed. Compiler output is:
cl -I"C:\Program Files\MATLAB\R2018a\extern\include" /Zp8 /W3 /nologo
-I"E:\support_Matlab\DelCom"
-I"E:\support_Matlab\DelCom"
"delcom_thunk_pcwin64.c" -LD -Fe"delcom_thunk_pcwin64.dll"
delcom_thunk_pcwin64.c
E:\support_Matlab\DelCom\delcom.h(44) : error C2061:
syntax error : identifier 'SHORT'
E:\support_Matlab\DelCom\delcom.h(46) : error C2059:
syntax error : '}'
E:\support_Matlab\DelCom\delcom.h(55) : error C2016:
C requires that a struct or union has at least one member
E:\support_Matlab\DelCom\delcom.h(55) : error C2061:
syntax error : identifier 'HANDLE'
E:\support_Matlab\DelCom\delcom.h(56) : error C2061:
syntax error : identifier 'DType'
E:\support_Matlab\DelCom\delcom.h(56) : error C2059:
syntax error : ';'
E:\support_Matlab\DelCom\delcom.h(58) : error C2059:
I have successfully used loadlibrary with other dll's.
Does anyone have any idea why it will not work with this particular DLL?
thank you for any insight

回答 (2 件)

Philip Borghesani
Philip Borghesani 2018 年 11 月 2 日
It appears that delcom.h requires a #include of windows.h. This answer has more information. There are also other answers by me that contain ways to work around the issue.
If you can't figure it out add a comment here with any progress you have made.
  1 件のコメント
dave
dave 2018 年 11 月 2 日
i think i added to thread instead of commenting here. please see my next post.
I was not able to get this to work. If you have further suggestions, please let me know. thanks!

サインインしてコメントする。


dave
dave 2018 年 11 月 2 日
Hi Philip, thanks for your help.
I tried adding
#include windows.h to the header file
i also tried
#include "windows.h" as i wasn't sure for the correct syntax.
In any case, neither case worked for me and i still end up with many warnings and errors: This is sample of the warnings and errors:
Function pointer types are unsupported in structures HRESULT ( __stdcall * Resolve )( IAgileReference * .
Found on line 225587 of input from line 7748 of file C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\um\\objidlbase.h
Function pointer types are unsupported in structures HRESULT ( __stdcall * QueryInterface )( IMallocSpy * .
Found on line 236332 of input from line 8311 of file C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\um\\objidl.h
Function pointer types are unsupported in structures SIZE_T ( __stdcall * PreAlloc )( IMallocSpy * .
Found on line 236332 of input from line 8311 of file C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\um\\objidl.h
Function pointer types are unsupported in structures void *( __stdcall * PostAlloc )( IMallocSpy * .
Found on line 236332 of input from line 8311 of file C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\um\\objidl.h
Function pointer types are unsupported in structures void *( __stdcall * PreFree )( IMallocSpy * .
Found on line 236332 of input from line 8311 of file C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\um\\objidl.h
Found on line 283638 of input from line 296 of file E:\\aaa_SVN\\calibration\\Source\\support_Matlab\\DelCom\\delcom64.h
*********
Error using loadlibrary
Building delcom64_thunk_pcwin64 failed. Compiler output is:
cl -I"C:\Program Files\MATLAB\R2018a\extern\include" /Zp8 /W3 /nologo
-I"E:\aaa_SVN\calibration\Source\support_Matlab\DelCom"
-I"E:\aaa_SVN\calibration\Source\support_Matlab\DelCom" "delcom64_thunk_pcwin64.c" -LD
-Fe"delcom64_thunk_pcwin64.dll"
delcom64_thunk_pcwin64.c
E:\aaa_SVN\calibration\Source\support_Matlab\DelCom\delcom64.h(186) : error C2061: syntax error
: identifier 'CUSBHIDIO'
E:\aaa_SVN\calibration\Source\support_Matlab\DelCom\delcom64.h(186) : error C2059: syntax error
: ';'
E:\aaa_SVN\calibration\Source\support_Matlab\DelCom\delcom64.h(187) : error C2449: found '{' at
file scope (missing function header?)
E:\aaa_SVN\calibration\Source\support_Matlab\DelCom\delcom64.h(218) : error C2059: syntax error
: '}'
delcom64_thunk_pcwin64.c(99) : error C2061: syntax error : identifier 'ulongThunk'
delcom64_thunk_pcwin64.c(99) : error C2059: syntax error : ';'
delcom64_thunk_pcwin64.c(99) : error C2059: syntax error : 'type'
delcom64_thunk_pcwin64.c(408) : error C2061: syntax error : identifier 'CUSBHIDIO'
delcom64_thunk_pcwin64.c(408) : error C2059: syntax error : ';'
delcom64_thunk_pcwin64.c(408) : error C2449: found '{' at file scope (missing function header?)
delcom64_thunk_pcwin64.c(419) : fatal error C1004: unexpected end-of-file found
Do you have any further thoughts? I really don't know what else to try
Thanks dave

カテゴリ

Help Center および File ExchangeC Shared Library Integration についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by