Problem while generating a pointer to a struct (a field of the struct is a pointer to a function)
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Structures dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!