Problem while generating a pointer to a struct (a field of the struct is a pointer to a function)
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Structures finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!