DLL Programmer's Guide for TNS/R Systems
Essential DLL Facility Controls
DLL Programmer’s Guide for TNS/R Systems—522203-002
2-10
Libraries the Linker Searches For and Opens
Where The Linker Searches for Libraries and Archives
The following example adds a library, whose unqualified name is libfile1, to the
link.
ld linkfile1 linkfile2 archfile1 -lib libfile1 -dll -o mainout
If libfile1 were a qualified name, the linker would open it normally, just as it did for
the two linkfiles and the archive. However, since libfile1 is an unqualified name,
the linker searches for it, and the linker must know where in the file system to look for
it. This is defined by the linker search path, which specifies the sequence of directories
or subvolumes in which the linker looks for directly referenced libraries. This path is
specified by the following sequence in the order shown:
1. A directory or subvolume you specify in a -first_L pathname option in the
linker’s command stream, where pathname is a path to a specified directory or
subvolume. Only one path or directory can be inserted with each -first_L
option, so one such option must be inserted for each path or directory needed. The
linker searches the specified directories or subvolumes in the sequence that the
-first_L options are inserted.
2. The public libraries, which are TNS/R-supplied hybrid-SRLs. Since the public
libraries cannot store archives, the linker will bypass this step if -b static is in
effect, as discussed in Making the Linker Accept Only DLLs or Only Archives on
page 5-1.
3. The directory or subvolume you specify in a -libvol pathname option in the
linker’s command stream, where pathname is a path to a specified directory or
subvolume. -L, in upper case, is a synonym for -libvol. Only one path or
directory can be inserted with each -libvol option, so one such option must be
inserted for each path or directory needed. The linker searches the specified
directories or subvolumes in the sequence that the -libvol options are inserted.
4. For OSS, where the value of the environmental value COMP_ROOT prefixes each
of the following names: /lib, /usr/lib, /usr/local/lib. Finally, unless the
-b static option is in effect, (see Making the Linker Accept Only DLLs or Only
Archives on page 5-1), the linker looks in /G/SYSTEM/ZDLL.
For Guardian, unless the -b static option is in effect, the linker looks in
$SYSTEM.ZDLL.
For Win 32, the linker does not search in any standard places.
You can have the linker skip steps 2 and 4 above by inserting the -nostdlib option
or its synonym -no_stdlib.In this event, the linker will only look for libraries in
places specified by -first_L or -libvol options. -nostdlib is a one-time
option that applies to the linker only; it has no effect on subsequent loader operation.