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.
Best Answer