Re: dll memory management
From: Michael Brown (see_at_signature.below)
Date: 09/24/04
- Next message: J French: "Re: Delphi Quiz"
- Previous message: Michael Brown: "Re: Website"
- In reply to: Jean Bambois: "dll memory management"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 24 Sep 2004 22:32:02 +1200
Jean Bambois wrote:
> Hi
>
> I have a simple question :
> if i load dynamically twice the same delphi dll, will the class
> variables have the same values in the two cases ?
How do you mean "load twice"? If you do something like:
hLib1 := LoadLibrary('mydll.dll');
hLib2 := LoadLibrary('mydll.dll');
Then you actually only have one instance of the library loaded into memory
(though it has a reference count of two, so you need to call FreeLibrary
twice before it's unloaded). In other words, the library is only loaded
once. However, if you do
hLib1 := LoadLibrary('mydll.dll');
FreeLibrary(hLib1);
hLib2 := LoadLibrary('mydll.dll');
Then there's nothing to say that the second time the library is loaded it
will end up in the same place (or that dynamically allocated data in the
second DLL will be in the same location as the first.
Finally, if two different processes load the DLL, then it's the same as the
second case: all bets are off in terms of where things end up.
[...]
-- Michael Brown www.emboss.co.nz : OOS/RSI software and more :) Add michael@ to emboss.co.nz - My inbox is always open
- Next message: J French: "Re: Delphi Quiz"
- Previous message: Michael Brown: "Re: Website"
- In reply to: Jean Bambois: "dll memory management"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|