TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Denis Tonn
from: Jonathan de Boyne Pollard
date: 1998-09-27 15:10:30
subject: How do DLLs load and unload ?

DT> The loader will automaticly do a DosLoadModule (and fixup) for any 
 DT> modules referenced in the header of the executable. I call this "load
 DT> time" linking vs "run time" linking done with an explicit
 DT> DosLoadModule and DosQueryProcAddr from within the app.  I don't like
 DT> to use the terms "static" or "dynamic" linking
here, they can have
 DT> slightly different connotations in the context of a  compiler and
 DT> it's run time libraries.. 

Me neither.

From what I can gather, by the way, only the module for the main EXE and
for DOSCALL1 are loaded by the parent process.  All other referenced DLLs
are loaded by a special user-mode function in DOSCALL1 that is where the
first thread in the process first starts executing.  

But this brings up a further question: What happens when a DLL cannot be
found ?  This should be, and *is*, reported in the pObjName buffer for
DosExecPgm.  I can see how this would be easy to implement if it were the
*parent* process that resolved all of the import module references and
built the initial user address space of the child.  But how does this
happen if the loading is occurring as part of the execution of user-mode
code in the child process ?  Don't tell me that there's a back door in OS/2
Warp for user-mode code in one process to write to the user address space
of another process!

 ¯ JdeBP ®

--- FleetStreet 1.19 NR
* Origin: JdeBP's point, using Squish (2:440/4.3)
SEEN-BY: 396/1 632/0 371 633/210 260 267 270 371 635/506 728 639/252 670/218
@PATH: 440/4 255/1 251/25 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™.