DLL Programmer's Guide for TNS/R Systems
DLLs on a TNS/R System
DLL Programmer’s Guide for TNS/R Systems—522203-002
1-10
Linkfiles and Archives
In addition to accessing public libraries (hybrid SRLs), PIC programs and DLLs will
automatically access the system and millicode libraries, without your specifying this
linkage requirement. The system and millicode libraries are non-PIC libraries that the
system loads before loading any application code, and the loader and operating
system automatically link your application to these libraries as appropriate.
Linkfiles and Archives
When the linker is building a new loadfile, its command stream must contain the names
of one or more linkfiles to be transformed into the loadfile. A programmer brings
together linkfiles to make a loadfile because these linkfiles are designed to work
together and they often cross-reference each other.
A linkfile can also be stored in an archive, which is a file that holds one or more
linkfiles. Normally an archive stores what might be called auxiliary linkfiles, which serve
general purposes and can be included in different links. For example, you might store a
number of utility routines as linkfiles in an archive and incorporate them as needed.
Import Controls
Import controls allow you to determine from which other loadfiles your loadfile can
import symbols. These controls take the form of attributes that you assign to your
loadfile. This topic is discussed in detail in Import Controls and SearchLists on
page 4-5. The three variants of import controls are:
•
Localized — A localized loadfile can import symbols from certain libraries in this
loadfile’s loadList. The choice of libraries is discussed in detail in The SearchList
for a Localized Loadfile on page 4-5.
•
Globalized — A globalized loadfile can import symbols from the program it is
loaded with and any loadfile in the program’s loadList.
•
Semi-globalized — A semi-globalized loadfile uses its own definition for any of its
symbol references when it offers such a definition, but imports other definitions
from the program it is loaded with and any loadfile in the program’s loadList.
In any case, if the symbol to be imported is defined only once in the collection of
loadfile candidates to supply imported symbols, that symbol is used to resolve your
loadfile’s need. Good practice normally avoids multiple definitions of the same symbol
in the loadfiles in a loadList, because of the danger that an imported symbol could be
resolved in an unexpected way. However, the library facility allows multiple definitions,
and symbol resolution in such cases is discussed in Import Controls and SearchLists
on page 4-5.
Localized symbol resolution is consistent with longstanding conventions on NonStop
systems including TNS programs and user libraries, as well as native non-PIC
programs and SRLs. The linker’s default is to localize loadfiles. On the other hand,
globalized symbol resolution is an industry (UNIX) standard. One useful consequence
of globalized symbol resolution is that DLLs can import symbols from their clients,
including the program. Globalized symbol resolution can be especially useful when