I have a mex module called p.mexw64
which uses another dll called p.dll
The mex module loads p.dll
when it is loaded since it is linking to it's lib file.
Normally, when I want to recompile p.dll
I do clear p;
. This unloads p.mexw64
and then in turn also unloads p.dll
.
Except when it doesn't. In some scenario which I can't really quantify p.mexw64
is unloaded (I see that it is in Process Explorer) but p.dll
remain loaded and is not freed.
Then I'm forced to close matlab in order to recompile d.dll
which is a pain.
What could possibly make this dll remain loaded after the mex which used it is gone?