필터 지우기
필터 지우기

Problem while generating a pointer to a struct (a field of the struct is a pointer to a function)

조회 수: 1 (최근 30일)
I would like to create a pointer to a struct and then use it as an input in *.dll function call. Some fields of the struct are numbers but a few of them are function pointers (fcnPtr).
Please have a look in below pseudo-code:
loadlibrary('myLib.dll', 'my_header.h', 'mfilename', 'myLibbit.m')
myStruct.dev_id = uint8(1);
myStruct.read = @myReadFunction; % Function handle
myStructMatlab = libstruct('struct_name', myStruct);
myStructMatlabPt = libpointer('struct_namePtr', myStructMatlab);
I get the following error:
Cannot convert data value for field read due to error:
Array must be numeric or logical or a pointer to one
Error in libstruct (line 16)
ptr=feval(['lib.' structtype],initialvalue);
In case that I do not use the field myStruct.read the above process works fine. Is there a way to solve the above issue?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by