Accessing enum value in DLLs header file

Hello,
I am using a DLL for device communication. Loading the DLL works. There are some enumerations defined in the DLLs header file. How can i access those? Just writing the enum value as string leads to an error that "Parameter must be scalar".
Thanks alot

답변 (1개)

dpb
dpb 2013년 12월 16일

0 개 추천

You can't get at them unless the symbols are exposed by the DLL which in general they wouldn't be except as internal. AFAIK the only way you'll see these would be to use LOADLIBRARYEX with DONT_RESOLVE_DLL_REFERENCES and then read the data area containing the enumerations. It's probably both easier and safer to simply recreate them for your application.

댓글 수: 2

Olaf
Olaf 2013년 12월 16일
I managed to find a way to access the enums.
loadlibrary('somelib.dll', 'somelib.h', 'mfilename', 'somelibM'); [methodinfo, structs, enuminfo, ThunkLibName] = somelibM;
then i can access the enum like
enuminfo.EMYEnum.eENUMVALUE
I am not sure, if thats the best way, but i works.
dpb
dpb 2013년 12월 16일
That's better than I had thought probably possible...good to know (I guess :) )

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Variables에 대해 자세히 알아보기

태그

질문:

2013년 12월 16일

댓글:

dpb
2013년 12월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by