ld Manual

Introduction to ld
ld Manual529650.001
1-21
Examples
OSS File Names
The OSS and Windows versions of ld can modify the simple name as follows:
In dynamic linking, ld first looks for a file named libfile name.so, then for
libfile name.srl, and finally for a file named libfile name.a. In static
linking, ld looks only for a file named libfile name.a. ld follows this process in
each directory it is searching before moving on to the next directory.
You can use the -verbose flag to cause ld to report the locations where it found
each file. (The Guardian version of ld has -verbose set by default.) For more
information, see -noverbose or -no_verbose.
Examples
In Example 1-11, the Guardian version of ld performs dynamic linking (the default)
and searches for the C run-time library (ZCRTLSRL) and the CRE library (ZCRESRL)
in the subvolume with the current version of the operating system image.
In Example 1-12, the OSS version of ld performs dynamic linking (the default) and
searches for the C run-time library (ZCRTLSRL) and the CRE library (ZCRESRL) in
the subvolume with the current version of the operating system image. This subvolume
is in the Guardian file system although ld accesses the subvolume using the OSS /G
path name syntax. Because the files are in the Guardian file system, ld does not
modify the simple name.
In Example 1-13, the OSS version of ld performs dynamic linking (the default) and
searches for the COBOL run-time library (ZCOBSRL) and the CRE library (ZCRESRL)
in the subvolume with the current version of the operating system image.
Linking Specified Prefix Added to Simple Name Suffix Added to Simple Name
Dynamic lib .so, .srl
Static lib .a
Example 1-11. Searching for ZCRTLSRL and ZCRESRL (Guardian)
ld OBJECTA OBJECTB -l ZCRTLSRL -l ZCRESRL
Example 1-12. Searching for ZCRTLSRL and ZCRESRL (OSS)
ld objecta.o objectb.o -l ZCRTLSRL -l ZCRESRL
Example 1-13. Searching for ZCOBSRL and ZCRESRL (OSS)
ld a.out b.out -l ZCOBSRL -l ZCRESRL