INF:Loader Uses Return Value from DLL's Initialization Routine

ID Number: Q50519

5.10 6.00 6.00a

OS/2

Summary:

In Microsoft C versions 5.1, 6.0, and 6.0a, the return value from a

DLL's initialization is used by the loader.

Using an initialization routine for your DLL is optional. The

initialization routine can be global or instance. The initialization

routine is called when the DLL is loaded. [This is not necessarily the

same time as when a DLL-exported function is called. For example, if

you load the DLL using DosLoadModule() and DosGetProcAddr(), the

initialization routine is run and the return value is examined at that

time.]

Every time you run a program that uses DLLs, the loader goes through

the import list in the exehdr and attempts to load all the DLLs. As it

tries to load each DLL, it runs its initialization routine (depending

on whether the initialization routine is instance or global). If the

initialization routine fails (even if the DLL is found) the system may

display a message, or simply terminate at that point.

Initialization routines are mentioned in Ray Duncan's book, "Advanced

OS/2 Programming," in Chapter 19, "Dynamic Link Libraries," pages

459-469.

Additional reference words: 5.10 6.00 6.00a