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-2
Working in the Guardian Environment
step, and what is the possible output from each compilation step. This section provides
you with this information.
After compiling your C++ program, you run the Binder to create an executable
C++ object file. This section describes a sample set of Binder commands that you can
use to bind your C++ programs.
You can use the Accelerator or OCA to make programs more efficient on native
systems. The same rules that apply to accelerating C programs apply to accelerating
C++ programs. If you want to accelerate your program, see the Accelerator Manual or
Object Code Accelerator (OCA) Manual for the necessary information.
Cfront is shipped with a simple TACL macro, named cplus, that allows you to
consolidate the compilation process. The cplus macro is also provided here for your
information:
?tacl macro
==This is a general purpose macro to use with Cfront on an HP™
System. You can add any preprocessor options such as
== SSV pragmas to this macro.
==
purge %1%1, %1%2, %1%o, %1%L
#output Preprocessing %1%c
cprep /in %1%c, out %1%1/ define __cplusplus, ssv0
"$system.system"
[#if NOT(:_COMPLETION:COMPLETIONCODE>1) |THEN|
#output Finished Preprocessor step. Starting CFRONT.
cfront /in %1%1, out %1%2/
[#if NOT(:_COMPLETION:COMPLETIONCODE>1) |THEN|
#output Finished CFRONT step. Starting C.
c /in %1%2, out %1%L/%1%o; suppress
[#if NOT(:_COMPLETION:COMPLETIONCODE>1) |THEN|
#output Finished C step. Purging intermediate files.
purge %1%1, %1%2, %1%L
]
]
]
If the C++ files Cprep, Cfront, and the C compiler are installed on $SYSTEM, the TACL
macro cplus should be in $SYSTEM.ZCFRONT.
To use this macro, the name of your C++ source file must end in the letter “c.” For
example, the command syntax to compile a C++ program located in file helloc is:
cplus hello
If the name of your C++ source file does not end in the letter “c,” you should either
rename your source file or modify the cplus macro.