DLL Programmer's Guide for TNS/R Systems

Essential DLL Facility Controls
DLL Programmer’s Guide for TNS/R Systems522203-002
2-11
Specifying a User Library for a Program
The following example causes the linker to look for a library listed in a -lib option
first in a private subvolume, pvtsvol, before looking for it in the public libraries.
ld linkfile1 linkfile2 -lib dllfile1 &
-first_L pvtsvol -dll -o mainout
You may find it convenient to use a common search path that can work on different
linker platforms. The linker design supports this by allowing directory and subvolume
names for different platforms to be mixed in one search path definition. In this case, the
linker on one platform will find in its search path some directory or subvolume names
that are syntactically incorrect, because they are for the other platform. It quietly
ignores these and searches only the ones it deems correct.
Allowing Missing Libraries
The linker terminates in error when it cannot find a file it searches for, unless it has
been instructed to allow missing libraries using the -allow_missing_libs option.
If the linker is directed to search for archives as well as libraries, then operating under
the -allow_missing_libs option, the linker treats any missing file as a library;
hence, it can miss an archive as well. -allow_missing_libs is a one-time option.
If -allow_missing_libs is specified, and a specified library is not found, the name
from the -lib option is placed into the libList of the output loadfile.
Specifying a User Library for a Program
When linking a PIC Program, you can make an existing DLL the program’s user library
by inserting the -set libname ULName option, where ULName is the name of that
DLL. -libname is a synonym for -set libname.ULName must be a fully qualified
Guardian file name on the execution target. -set libname is only valid when linking
a program.
At a Glance: Files the Linker Brings into a Link
Compile-Time Control of Export and Import
The TNS/R C and C++ compilers provide facilities to specify export and import controls
at compile time. The syntax involves a modifier, export$ or import$, which can be
placed on the declaration of an identifier. As their names imply, they cause the
compiler to mark the associated definition as exported or imported, respectively. When
applied to the declaration or definition of an individual function or variable, it affects that
To incorporate in a link: Action:
A linkfile, archive, or
library to open
normally
Insert its qualified file name directly in the
command stream
An archive or
library to search for and
open
Insert its unqualified file name in a -lib
option