I have created a dll in c#. I added a reference to this dll in MATLAB as shown below. Everything works fine. The problem is that when I want to update my dll I have to close
As a workaround, you can start a new Matlab instance from Matlab itself with a system call and the Matlab command line options and only load the libraries in the new instance. This is described in an answer to the qestion: Release a .NET assembly from MATLAB
Have you tried cls.delete
and then add the reference again?
I seem to remember clear classes
being useful as well. Sorry I can't be more definitive, I don't have Matlab handy to set up an example.
Edit
Looks like I was wrong, according to this link, "you cannot unload an assembly from MATLAB."
If the most important thing is the downtime while an assembly is being swapped, then you can do this without having to load a new MATLAB instance at all (which is very slow).
Even in pure .NET, it's not possible to unload an assembly from an AppDomain. Too much state is affected by the JIT process -- bits of code from that assembly could have been inlined into many other functions. This is actually one of the big reasons for having the AppDomain feature in the first place.
So, you will need a .NET assembly that acts as a wrapper and never changes. Its function will be to create an AppDomain and load the assembly to test into that child AppDomain. And, when it changes, to destroy the child AppDomain and create a new one.
It's complicated, but isolates MATLAB from the complexity.