TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Jonathan de Boyne Pollar
from: Denis Tonn
date: 1998-10-09 18:10:06
subject: How do DLLs load and unl

Original from  Jonathan de Boyne Pollard  to Denis Tonn on 10-06-1998
Original Subject: How do DLLs load and unlo

                         ---------------------------------------

  DT> The reference count is only the number of processes that are using 
  DT> the DLL. [...] The reference count is a count of the number 
  DT> of *processes* that are using a DLL. 
 
JP> Yes, there is a reference count for the number of processes that are using an 
JP> MTE entry.  But there is *also* a reference count for each 
JP> module loaded into a process.  You can demonstrate this to 
JP> yourself -- as I did -- by writing a program that calls 
JP> DosLoadModule several times for the same module.  One 
JP> discovers that DosLoadModule returns *the same handle* for 
JP> each call.  One can then add further code to the program to 
JP> see how many times one has to call DosFreeModule before the 
JP> handle becomes invalid.
JP> 
JP> It turns out that OS/2 Warp keeps a reference count of the 
JP> number of times that a module has been loaded by 
JP> DosLoadModule() into a process, and only unloads the 
JP> module, and calls its termination function, when an equal 
JP> number of DosFreeModule()s have happened.

 Correct.. Key point.. Init/Term is ONLY called just after the module 
is *first* mapped/loaded into the process, and just before it is 
unmapped/unloaded. 



   Denis       

 All opinions are my very own, IBM has no claim upon them
. 
. 
.
 

 



--- Maximus/2 3.01
* Origin: T-Board - (604) 277-4574 (1:153/908)
SEEN-BY: 396/1 632/0 371 633/210 260 267 270 371 635/506 728 639/252 670/218
@PATH: 153/908 8086 800 140/1 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.