DLL Programmer's Guide for TNS/E Systems

Essential DLL Facility Controls
DLL Programmer’s Guide for TNS/E Systems527252-006
2-9
Library Inputs
While the archive is open (when -none is in effect), the linker searches for symbols
that are unresolved in the loadfiles seen so far, or specified by the -u option, or
unresolved in linkfiles selected from the archive. The archive can have indirectly
needed linkfiles. The linker finds them regardless of their order. (That is, the linker
makes multiple passes over the archive while it has it open, if necessary to resolve
symbols introduced by linkfiles in the archive.)
Library Inputs
In addition to linkfiles and archives, a loadfile being linked can also obtain symbol
definitions from existing loadable libraries. You must know which symbols the loadfile
you are creating will import from existing libraries, and tell the linker which libraries can
resolve those symbols by inserting their file names in the command stream. Using
these names, the linker opens the corresponding files and reads their internal names
to build the libList in the resulting loadfile. There it lists the libraries in the order that you
inserted them; these libraries are called your loadfile’s libListed libraries. Later, the
loader uses this libList on the execution target to find the libraries that will resolve your
loadfile’s symbol references and to build your loadfile’s loadList.
Thus, when linking your loadfile, the order in which you insert library names into the
linker’s command stream determines the order that the linker processes them and lists
them in your loadfile’s libList. The order of library names is unaffected by the mingling
in the command stream of other inserted tokens among these names.
Figure 1-4 on page 1-9 shows that when linking the program, the programmer inserted
the file names of DLLs A, B, and C, in that sequence. It also shows that:
A requires D and E.
Both D and E require G.
Both B and C require F.
To get these results, when A was linked, its programmer inserted first the names D
then E. When D and E were linked, their programmers inserted G. Likewise, when B
and C were linked, their programmers inserted F.
Library names can safely be inserted anywhere in the command stream, because their
symbols are made available as needed in the link regardless of their inserted position.
Also remember, when a TNS/E compiler invokes the linker for you, the compiler
automatically ensures that the object files are linked to any required standard run-time
libraries.
Specifying Where the Linker Can Find Its
Inputs
The previous section discussed how to tell the linker what items go into a link. This
section focuses on how to tell the linker where to look for these items in the file system
of the linker platform. The linker can find files in several different ways: