Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to recompile model DLL without restarting MATLAB?

I am in the process of developing an SFunction and compiled submodel in Simulink, an SFunction that calls into a DLL compiled using Realtime Workshop. The problem is, once I compile the submodel once, execute it in native Simulink through the SFunction and the model finishes, MATLAB still keeps a handle to the submodel DLL. I cannot recompile the DLL until MATLAB is restarted, forcing the release of the DLL.

I have even gone so far as to see if ProcessExplorer could force closed the handle but it can't.

like image 979
J Collins Avatar asked Oct 03 '22 02:10

J Collins


2 Answers

How do you bind the S-Function to the DLL? If you bind at link time then you could try to bind at runtime and explicitly release the handle in mdlTerminate. That way, MATLAB should never even know that you accessed the DLL. Of course this makes the actual interaction with the DLL from within the S-Function somewhat messier.

like image 100
Florian Brucker Avatar answered Oct 13 '22 10:10

Florian Brucker


I think it would work if you just rename the actual DLL to something else and then recompile. I know it works for mex files. If this doesn't work, you can try this solution.

like image 28
m_power Avatar answered Oct 13 '22 10:10

m_power