DLL Programmer's Guide for TNS/E Systems
DLLs on a TNS/E System
DLL Programmer’s Guide for TNS/E Systems—527252-006
1-13
User Library
An important advantage of dynamically loaded DLLs is that their names and their
symbols need not be known when the program is constructed. Using this facility, you
can add to an existing application a new DLL that provides new functionality without
even restarting the application.
You do not need to load infrequently used DLLs when the application is loaded.
Instead, you can load and use these DLLs when required and unload them when they
are no longer needed. They can be reloaded whenever necessary.
User Library
A program, but not a DLL, can be linked to one user library, which is a DLL having a
special relationship to the program. Instead of adding the user library’s name to the
program’s libList, the user-library name is recorded in the program loadfile as an
attribute called libname. However the linker and loader treat this DLL as if it were first
in the program’s libList, and a program’s loadList always begins with the user library if
there is one.
It should be noted that you can run two instances of the same program simultaneously
where each instance of the program uses a different user library.
The starting virtual addresses of the program text (code) and data segments are
system constants, set by the linker and enforced by the operating system. The linker
also sets "preferred" virtual addresses for the text and data of DLLs, either by default
or from command-string input. (DLL data immediately follows the text.) If the preferred
address ranges are available at load time (do not conflict with already loaded objects
or reserved areas), they are used; otherwise the operating system finds an available
address range for the DLL.
Like any other DLL, a user library can require other libraries. Figure 1-5 below shows a
User Library assigned to Program, and this User Library itself requires the library Lib H.
Program directly references the user library and hence indirectly references H.
You can assign a DLL as a user library to a program when you link or load that
program, or by a special linker command that allows you to change this assignment in
an existing program. More detail is provided in How to Set Run-Time Attributes of Your
Loadfile on page 5-6.










