overview.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Using Dynamic-Link Libraries (1.2)
About Section  Function Group                     Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
                        Using Dynamic-Link Libraries
 
All MS OS/2 programs use dynamic linking, since this is the only way
programs can link to and call the MS OS/2 system functions.
 
If you use the dynamic-link functions to work with dynamic-link libraries,
the first step is to load the library by using the DosLoadModule function.
This function takes the name of the library as a parameter and returns a
handle for the module. If the library is not in one of the directories
specified by the libpath command in the config.sys file, you must supply a
full path with the filename. If the library is not found, the function
returns an error.
 
After the library is loaded, the program can retrieve the address of a
specific function by using the DosGetProcAddr function. DosGetProcAddr takes
a function name as a parameter and supplies the function's address. The
function name must be spelled exactly as it appears in the library; this is
typically in all uppercase letters if the Pascal calling convention is used.
The function can be called like any MS OS/2 system function. The calling
program must provide correct parameters in the correct order and of the
correct type.
 
After a program has finished using a library, it can free the library by
using the DosFreeModule function. If no other program is using the library,
MS OS/2 removes the library from memory. The system keeps only one copy of a
library in memory, no matter how many programs have loaded it.
 
You can use the DosGetModHandle and DosGetModName functions to help manage
the libraries you have loaded.
 
 
                                      ♦