How do I create a function pointer that points to an MATLAB file using LIBPOINTER in the MATLAB Generic DLL interface?
Show older comments
I am using the MATLAB Generic DLL interface to load and use my shared library file in MATLAB. One of the functions in this library requires a function pointer as one of its input arguments. This function pointer can serve, for example, to invoke a callback routine at the C level.
I would like to indicate an MATLAB file as the callback routine for this library function. In the same way that the LIBPOINTER function can be used to create pointer objects from MATLAB variables for use with the shared library, I have tried using a construct such as this to achieve that functionality:
fPtr = libpointer('voidPtr',@myMCallback);
...
result = calllib('myshrlib', 'foo', ... , fPtr);
where @myMFileCallback is a handle to myMCallback.m. These attempts did not work.
I would like functionality in MATLAB that allows me to specify an MATLAB file as the callback routine for a C shared library function.
Accepted Answer
More Answers (0)
Categories
Find more on C Shared Library Integration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!