title: Mex function not updated after recompile
body: <p>I have a simple mex function, which calls another C++ function from a library. I compile the source with</p>
  
  <pre><code>mex -cxx mymexfunction.cpp -I/some/include -L/some/lib -lmylib
  </code></pre>
  
  <p>The mylib library is dynamic (.so) and is linked itself against some other libraries (boost, OpenCV and some more).</p>
  
  <p>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</p>
  
  <pre><code>clear
  clear all
  clear mex
  clear functions
  clear fun('mymexfunction')
  munlock('mymexfunction')
  unloadlibrary('mymexfunction')
  </code></pre>
  
  <p>...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).</p>
  
  <p>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.</p>
  
  <p>Are there some known conditions which could cause such problems?</p>
  
  <p><em>Clarification:</em></p>
  
  <p>I only update the content of the mex function, not the library.</p>
  
  <p><em>Update:</em></p>
  
  <p>It works under Ubuntu 11.04 with Matlab R2011a!  I tried to reproduce the same environment on my OpenSUSE machine (R2011a, Boost 1.42, OpenCV 2.2 dynamically linked, ...) but still no luck.  So I conclude that nothing is actually wrong with my library (otherwise it wouldn't work under Ubuntu) but it must be some collision of the dependencies and Matlab internal libraries. I officially give up.  Praetorian and Amro, thank you for your help!</p>