C/C++ Programmer's Guide (G06.25+)
Compiling, Binding, and Accelerating TNS C++
Programs
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
15-6
Working in the Guardian Environment
To send error and warning messages to a file, assign stderr to the desired file
name prior to invoking Cprep. You assign stderr to a file name as follows:
ASSIGN STDERR, file-name
To return to the default location, enter:
CLEAR ASSIGN STDERR
Example:
In this example, the C++ source file progcp is input to Cprep. An intermediate file,
intfile1, is created by Cprep for later use by Cfront. The SSV pragma SSV0 causes
any header files in progcp to be searched for in the subvolume hdrvol; that is, Cprep
looks in subvolume hdrvol for a file named hdrh if progcp contains the statement
#include "hdrh."
CPREP/IN progcp, OUT intfile1/define __cplusplus, SSV0 "hdrvol"
C++ Translator Cfront
Cfront generates code for the TNS C compiler. In so doing, Cfront performs the
following functions:
•
Always generates function prototypes
•
Uses the NOWIDE or RUNNABLE pragmas, if they were specified on the Cprep run
command line or in the C++ source
•
Generates the following pragmas: C_PLUS_PLUS, C_PLUS_PLUS_STMT,
NOWARN(134, 135), and SEARCH
•
Produces a C source file that serves as the input to the TNS C compiler
Pragmas Generated by Cfront
Cfront generates the following pragmas: C_PLUS_PLUS, C_PLUS_PLUS_STMT,
NOWARN(134, 135), and SEARCH. Each of these pragmas is explained below.
Pragma Use
C_PLUS_PLUS notifies the TNS C compiler that this object file is derived from
C++ source code.
C_PLUS_PLUS_STMT identifies a C++ statement to the TNS C compiler. This pragma
causes the next C statement to be identified as the start of
generated C code for the C++ statement to be found in the file and
at the line number specified by the latest #line directive. This
information is used for symbolic debugging.