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-10
Compiling a Module
If your program comprises a single module, you can use the RUNNABLE pragma to
direct the compiler to produce a program file instead of a nonexecutable object file.
If your program comprises more than one module, you can use the RUNNABLE and
LINKFILE pragmas to direct the compiler to produce a linked program file instead of a
nonexecutable object file. For details, see pragma LINKFILE on page 13-57.
To use the RUNNABLE pragma, one of the modules must contain the main function of
the program.
When you specify the RUNNABLE pragma, the native C and C++ compilers specify the
$SYSTEM.SYSTEM.LIBCOBEY command file to the linker. The LIBCOBEY file directs
nld or ld to link to a set of standard shared run-time libraries (SRLs). For most C and
C++ programs, this set of SRLs is sufficient to create an executable program. If your
program requires SRLs not specified in LIBCOBEY (such as the Tools.h++ SRL) you
can direct nld or ld to search additional SRLs using the LINKFILE pragma.
The NMC command invokes the TNS/R native C compiler. The NMCPLUS command
invokes the TNS/R native C++ compiler. The syntax for these commands is shown in
the following diagram.
[ RUN ] NMC
is the TACL command to start the TNS/R native C compiler process. The RUN
command keyword is optional.
[ RUN ] NMCPLUS
is the TACL command to start the TNS/R native C++ compiler process. The RUN
command keyword is optional.
IN source
specifies the primary source file of the module. The file must be a valid Guardian
file name for either a type 101 (EDIT) or type 180 disk file. Interactive input from a
terminal or a process is not accepted.
[ RUN ] { NMC | NMCPLUS } / IN source [ , OUT listing ]
[ , run-options ] / [ object ]
[ ; compile-option [ , compile-option ]... ]
compile-option:
{ pragma }
{ define identifier [ constant ] }
{ undefine identifier }