Question about dlls

W

Wild Wind

Hello,

I am developing a managed c++ library which loads a
regular win32 dll. The library will be used
by .NET consumers.

Am I correct in saying that the win32 dll will
not be unloaded until the garbage collector
destroys the mc++ library that loaded it
in the first place? And does this means that to
unload the library, I should call the Dispose
method of the library to free resources?
Do I need to put special code in this Dispose
method, or will it be all right just to rely
on the default code?

TIA,
 
R

Richard Blewett [DevelopMentor]

The GC does not unload assemblies. In normal circumstances once an assmbly is loaded it stays loaded until the application exits. The only way to unload an assembly is to unload the AppDomain which it is part of. But thats assemblies.

As far as unmanaged DLLs are concerned AFAIK they stay loaded until process exit - period.

Regards

Richard Blewett - DevelopMentor

http://staff.develop.com/richardb/weblog

nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<[email protected]>

Hello,

I am developing a managed c++ library which loads a
regular win32 dll. The library will be used
by .NET consumers.

Am I correct in saying that the win32 dll will
not be unloaded until the garbage collector
destroys the mc++ library that loaded it
in the first place? And does this means that to
unload the library, I should call the Dispose
method of the library to free resources?
Do I need to put special code in this Dispose
method, or will it be all right just to rely
on the default code?

TIA,

--
Akin

aknak at aksoto dot idps dot co dot uk



---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.766 / Virus Database: 513 - Release Date: 17/09/2004



[microsoft.public.dotnet.languages.csharp]
 
W

Wild Wind

Hello Richard,

Thank you for your answer.

Just to clarify - when you say:

"As far as unmanaged DLLs are concerned AFAIK they stay loaded until
process exit - period."

are you talking about the ProcessExit event of the AppDomain
of the managed assembly that loaded them up?

TIA,
 
R

Richard Blewett [DevelopMentor]

No, I mean when the win32 process that is hosting the CLR exits

Regards

Richard Blewett - DevelopMentor

http://staff.develop.com/richardb/weblog

nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<[email protected]>

Hello Richard,

Thank you for your answer.

Just to clarify - when you say:

"As far as unmanaged DLLs are concerned AFAIK they stay loaded until
process exit - period."

are you talking about the ProcessExit event of the AppDomain
of the managed assembly that loaded them up?

TIA,

--
Akin

aknak at aksoto dot idps dot co dot uk
The GC does not unload assemblies. In normal circumstances once an
assmbly is loaded it stays loaded until the application exits. The
only way to unload an assembly is to unload the AppDomain which it is
part of. But thats assemblies.

As far as unmanaged DLLs are concerned AFAIK they stay loaded until
process exit - period.

Regards

Richard Blewett - DevelopMentor

http://staff.develop.com/richardb/weblog


nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<2r5mcqF1
(e-mail address removed)>

Hello,

I am developing a managed c++ library which loads a
regular win32 dll. The library will be used
by .NET consumers.

Am I correct in saying that the win32 dll will
not be unloaded until the garbage collector
destroys the mc++ library that loaded it
in the first place? And does this means that to
unload the library, I should call the Dispose
method of the library to free resources?
Do I need to put special code in this Dispose
method, or will it be all right just to rely
on the default code?

TIA,

--
Akin

aknak at aksoto dot idps dot co dot uk



---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.766 / Virus Database: 513 - Release Date: 17/09/2004



[microsoft.public.dotnet.languages.csharp]




---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.766 / Virus Database: 513 - Release Date: 17/09/2004



[microsoft.public.dotnet.languages.csharp]
 

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

Top