How to acces lib.pointer in C++ Mex Files
Afficher commentaires plus anciens
Hello everyone,
I want to access lib.pointer within a mexFile using Matlab's C++ API. The pointer is transported as matlab::data::ArrayType::HANDLE_OBJECT_REF, but I don't know how to access the values within this structure. I want to convert this to a void pointer later. The lib.pointer contains a handle to a device and I am using this to communicate with the device via a separate API.
Hopefully someone can help me further.
Thank you in advance.
Réponses (1)
lib.pointer has a Value property. Pass that to your MEX function.
4 commentaires
Richard Z.
le 22 Jan 2025
What do you mean by "protect the handle"? What does it mean to "keep it in this lib.pointer"? Passing the Value to a MEX function doesn't mean you're taking it away from lib.pointer as long as you don't delete this object in the MATLAB workspace - it's still in lib.pointer. And lib.pointer is just a container, a segment of memory, containing that value, and it doesn't have any "protect" functionality that I understand.
Richard Z.
le 23 Jan 2025
埃博拉酱
le 23 Jan 2025
You can study these documents as follows:
Catégories
En savoir plus sur MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!