Mex function not updated after recompile
11 次查看(过去 30 天)
显示 更早的评论
I have a simple mex function, which calls another C++ function from a library. I compile the source with
mex -cxx mymexfunction.cpp -I/some/include -L/some/lib -lmylib
The mylib library is dynamic (.so) and is linked itself against some other libraries (boost, OpenCV and some more).
The problem I am having is that once I have called the function mymexfunction once, it will not get updated when I recompile the source code. I have tried
clear
clear all
clear functions
clear fun('mymexfunction')
munlock('mymexfunction')
unloadlibrary('mymexfunction')
...but nothing helps! I have to restart Matlab in order to be able to see the updated mexfunction. Even if I delete the compiled mex file and recompile, I still get the old version of the mex function (not on disk, but in memory).
All is fine if I don't link against mylib, but I have no idea what could be the culprit that prevents the update. The library is unfortunately too large and too interwoven to remove single modules one by one.
Are there some known conditions which could cause such problems?
3 个评论
Alec Jacobson
2020-6-12
Suffering for the same problem even in 2020a...wish this would be fixed or at least a solution provided.
回答(1 个)
Jan
2011-8-10
7 个评论
Paul Rötzer
2023-4-15
I struggle the same problem on Matlab 2022b on MacOSX (M1) but only when i compile from "outside" of matlab, i.e. when i use cmake build script. For functions which i build "inside" matlab the update works.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!