Releasing a native DLL

M

Mike King

How can we get ASP.NET/CLR to release a native DLL when using P/Invoke. We
are building a web application that uses a native DLL heavily. It's
unlikely that we will ever have a Managed DLL because of the 3rd party
static library (.LIB) file that we're using. The problem is that when one
of the pages that uses the native DLL is requested, the native DLL becomes
locked. We need the CLR to release the native DLL because when we go live,
we won't have control of the Web Server so we can't run "iisreset." I'm
guessing P/Invoke builds a proxy between the Managed DLL and the native DLL
an the proxy locks the DLL until it's garbage collected. Since the GC is
non-deterministic it's difficult to know when the native DLL will be
released. Does anyone know of a solution to this problem?
 
B

bruce barker

..net has no support for unloading a dll, only an AppDomain.

if you need the ability to unload a dll, you need to load it in its own
appdomain which you can unload at will. you will need to use a remoteing
proxy that calls the P/Invoke to talk across domains, so watch perfomance.
see "Programing with Application Domains".


-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top