I have a Mex-function, say myfunction.mexmaci64
(which is the correct ending on OS X).
Now, myfunction is linked against a library mylibrary.dylib
. Both, mex-file and library, reside in the same folder.
Now, whenever I change something in mylibrary
, MATLAB does not reload the new library version but instead uses the old one until I do restart MATLAB. That is very anoing when doing development and debugging work.
Is there a way to force MATLAB to reload the library without restarting the application?
Note: It would be easy to link the library statically into the mex function. However, as I link the same library across quite a few mex-files, I would prefer to keep my single shared library to reduce compilation times and data redundancy.
Edit:
Concerning the discussion wether the clear mex
helps:
[~, loaded_mexes] = inmem('-completenames'); % get canonica
returns a list with all loaded mex-files. This list does not contain the linked library, but only the mex-files itself. Using clear mex
successfully empties this list, but does not unload mylibrary
- running the mex function again still yields the same output as it did with the old shared library.