nld Manual
nld Utility
nld Manual—528272-001
2-27
Dynamic and Static Linking
If the -verbose flag is specified, nld writes to its output listing the locations where it
found an SRL or archive file. (The Guardian version of nld has -verbose set by
default.) For more information, see -verbose on page 3-16.
In Example 2-12, the Guardian version of nld performs dynamic linking (the default)
and searches for the C run-time library (ZCRTLSRL) and the CRE library (ZCRESRL)
SRLs in the subvolume with the current version of the operating system image.
In Example 2-13, the OSS version of nld performs dynamic linking (the default) and
searches for the C run-time library (ZCRTLSRL) and the CRE library (ZCRESRL)
SRLs in the subvolume with the current version of the operating system image. This
subvolume is in the Guardian file system although nld accesses the subvolume using
the OSS /G pathname syntax. Because the files are in the Guardian file system, nld
does not modify the simple name.
In Example 2-14, the OSS version of nld performs dynamic linking (the default) and
searches for the COBOL run-time library (ZCOBSRL) and the CRE library (ZCRESRL)
SRLs in the subvolume with the current version of the operating system image.
Dynamic and Static Linking
The flags -bdynamic on page 3-3 and -bstatic on page 3-4 specify dynamic and static
linking, respectively.
If the -bdynamic flag is specified, nld first searches for a shared run-time library
(SRL). If an SRL cannot be found, nld searches for an archive file. If neither file is
found, nld issues an error message. nld follows this process in each location (a
subvolume or directory) it is searching before moving on to the next location.
If the -bstatic flag is specified, nld searches for an archive file. nld does not
search for an SRL. If the archive file cannot be found, nld issues an error message.
Both the -bdynamic flag and the -bstatic flag can be specified in a single nld
invocation; therefore, it is possible to perform dynamic linking for some -l and -lib
options and static linking for others.
Example 2-12. Searching for ZCRTLSRL and ZCRESRL (Guardian)
NLD OBJECTA OBJECTB -l ZCRTLSRL -l ZCRESRL
Example 2-13. Searching for ZCRTLSRL and ZCRESRL (OSS)
nld objecta.o objectb.o -l ZCRTLSRL -l ZCRESRL
Example 2-14. Searching for ZCOBSRL and ZCRESRL (OSS)
nld a.out b.out -l ZCOBSRL -l ZCRESRL