C/C++ Programmer's Guide (G06.27+, H06.03+)

Table Of Contents
Compiling, Binding, and Accelerating TNS C++
Programs
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
15-17
Working in the G-Series OSS Environment
Input Files
Input files to TNS c89 can be:
C++ language source files
TNS object files generated by c89 -c
Libraries of TNS object files produced by the ar utility
Libraries of TNS object files produced by Binder
Executable TNS object files produced by Binder
Binding
The -lc and -lC operands specify these libraries:
In the absence of options that inhibit the invocation of the Binder, such as -c or
-Wnobind, the TNS c89 utility causes the equivalent of a -lc operand to be passed
to the Binder as the last -l operand, causing the standard TNS C library to be
searched after all other object files and libraries are loaded.
If one or more of the file operands are C++ source files, TNS c89 causes the
equivalent of a -lC operand to be passed to the Binder ahead of -lc. However, if a
separate binding process is invoked to bind C++ TNS object files, you are required to
specify -lC as one of the file operands ahead of -lc. If you do not specify -lC ahead
of -lc only the standard TNS C run-time library is used by the Binder.
Examples
Examples 1 and 2 shows how to compile a C++ program using the TNS c89 utility.
Example 3 shows how to perform some of the compilation steps without performing all
of them.
1. This example preprocesses hello.C with Cprep, translates it with Cfront,
compiles it with TNS C, and then binds it with the Binder to create an executable
file named a.out.
c89 hello.C
2. This example causes the same compilation steps to occur as in the previous
example except that the resulting executable file is named hello.
c89 -o hello hello.C
-lc This library contains all library functions specified in the POSIX.1
specification, except for those functions listed as residing in math.h.
-lC This is the TNS C++ run-time library. It should be bound before the standard
TNS C run-time library.