By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,978 Members | 1,831 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,978 IT Pros & Developers. It's quick & easy.

mixed assembly, unmanaged process, FreeLibrary (.NET 2.0)

P: n/a
DPR
Hi,

I've recognized that a mixed assembly with unmanaged exports and an
unmanaged "DllMain" can't be unloaded from a (unmanaged) process, even
if it's no longer needed and the (unmanaged) process calls the
"FreeLibrary" function.
I couldn't find any documentation for this special restriction ! So
isn't there any possibility to unload a mixed assembly manually from a
unmanaged process once it has been loaded without killing that process ?

I've tried to unload the whole CLR from the process in order to get the
assembly unloaded - but it seems that the CLR can't (???) be unloaded
from a running process once it has been loaded.

The MSDN documentation is very inconsistent as to this CLR behavior:

"CoUninitializeCor is obsolete. The common language runtime cannot be
unloaded from a process. To completely remove the runtime from a running
process, you must shut down that process."

ICLRRuntimeHost::Stop
"Do not call this method. The host cannot unload the runtime from a
process."

On the other hand:

ICorRuntimeHost::Stop
"Unloads the common language runtime from the current process."
[...]
"It is typically unnecessary to call this method, as the common language
runtime is automatically unloaded when the process exits.
Note:
After a call to Stop, the common language runtime cannot be
re-initialized into the same process."
Thanks for any help in advance !

--

DPR
Feb 6 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.