Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to I get Matlab to release the DLL?

4 views
Skip to first unread message

Eddie

unread,
Sep 1, 2010, 4:55:04 PM9/1/10
to
Hi

I've built a C# COM library dll and have run my matlab code that calls it. It works, but now I want to change the C# code and rebuild it. MSVC says:

error MSB3021: Unable to copy file "obj\Debug\M2_Socket_cSharpLib_Matlab.dll" to "bin\Debug\Socket_cSharpLib_Matlab.dll". The process cannot access the file 'bin\Debug\Socket_cSharpLib_Matlab.dll' because it is being used by another process.
Done building project "M2_Socket_cSharpLib_Matlab.csproj" -- FAILED.

How do I get Matlab to stop using the dll so that I can rebuild it?

(my current solution is to restart matlab....Arg.)

Cheers

James Tursa

unread,
Sep 1, 2010, 5:46:04 PM9/1/10
to
"Eddie " <epa...@yahoo.com> wrote in message <i5mej8$bg9$1...@fred.mathworks.com>...

How are you calling it ... through loadlibrary? If so, have you tried unloadlibrary?

James Tursa

Eddie

unread,
Sep 2, 2010, 1:02:22 PM9/2/10
to
Hi James

I'm using COM to allow Matlab to call the MSVC compiled C#. I do this by running regasm to register it (I got the code from here: http://www.mathworks.com/matlabcentral/fileexchange/16549).

Then I use activexserver

net = actxserver('Socket_cSharpLib_Matlab.PingIpAddr'); % Load the ActiveX ComMatlab

But you made me think of trying to use "release". In which case I thought I first had to get the handle using

K>> h = actxGetRunningServer('Socket_cSharpLib_Matlab.PingIpAddr');
??? Error using ==> actxGetRunningServer
The server 'Socket_cSharpLib_Matlab.PingIpAddr' is not running on this system.

But that didn't work as you can tell.

Cheers

ImageAnalyst

unread,
Sep 2, 2010, 3:29:39 PM9/2/10
to
It's not a graceful solution, it's more like an 800 pound gorilla
coming in and prying that creep's hands off your sister, but there's
Unlocker.
http://en.wikipedia.org/wiki/Unlocker
It will pry MATLAB's hands off your file, but there's no guarantee how
MATLAB will behave after that. It may be fine or it may have
problems. You have your choice if you want Unlocker to kill MATLAB,
or just pry its hands off. "Bad Matlab! Bad Matlab! Get down!"
0 new messages