C/C++ Programmer's Guide (G06.25+)
Compiling and Linking TNS/R Native C and C++
Programs
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
16-17
Linking a Module
For more information about the linkers, see the following manuals:
•
nld Manual
•
ld Manual
Examples
1. The specified nld flags link a VERSION2 Guardian C++ program that uses the
Tools.h++ class libraries (ZTLHSRL) and the Standard C++ Library (ZRWSLSRL):
> NLD $SYSTEM.SYSTEM.CRTLMAIN MYOBJ -o MYEXEC &
-l ZTLHSRL -l ZRWSLSRL -l ZCPLSRL -l ZCRTLSRL &
-l ZCRESRL
2. The specified nld flags link a VERSION2 OSS C program:
> NLD $SYSTEM.SYSTEM.CRTLMAIN MYOBJ -o MYEXEC &
-l ZTLHSRL -l ZRWSLSRL -l ZCPLSRL &
-l ZOSSHSRL -l ZCRTLSRL -l ZCRESRL &
-l ZOSSKSRL -l ZOSSFSRL -l ZSECSRL &
-l ZI18NSRL -l ZICNVSRL -l ZOSSESRL &
-l ZINETSRL -l ZSTFNSRL
3. A simplified version of the previous example:
> NLD $SYSTEM.SYSTEM.CRTLMAIN MYOBJ -o MYEXEC &
-OBEY $SYSTEM.SYSTEM.LIBCOBEY &
-l ZTLHSRL -l ZRWSLSRL -l ZCPLSRL
4. Linking with the ld linker and the VERSION3 Standard C++ Library (the default
beginning library beginning with G06.20):
> LD $SYSTEM.SYSTEM.CRTLMAIN MYOBJ -o MYEXEC &
-OBEY $SYSTEM.SYSTEM.LIBCOBEY -l ZSTLSRL
VERSION2 Standard C++
Library, Tools.h++ (version 7)
and runs in the OSS
environment
-l ZTLHSRL -l ZRWSLSRL -l ZCPLSRL
-OBEY $SYSTEM.SYSTEM.LIBCOBEY
or
-l ZTLHSRL -l ZRWSLSRL -l ZCPLSRL
-l ZOSSHSRL -l ZCRTLSRL -l ZCRESRL
-l ZOSSKSRL -l ZOSSFSRL -l ZSECSRL
-l ZI18NSRL -l ZICNVSRL -l ZOSSESRL
-l ZINETSRL -l ZSTFNSRL
VERSION3 Standard C++
Library and runs in the OSS or
Guardian environment
-l ZSTLSRL
-OBEY $SYSTEM.SYSTEM.LIBCOBEY
OSS nlist() function
-l ZUTILSRL and other SRLs required by the program
environment
TCP/IP socket library
-l ZINETSRL and other SRLs required by the program
environment
Table 16-6. Using the Guardian nld and ld Utilities to Link SRLs (page 2 of 2)
If your program uses: You should specify these nld/ld utility flags: