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

Usage Guidelines
The TDS version of the TNS/R native C/C++ cross compiler produces object code that runs only
on a TNS/R system in either the Guardian or the OSS environment.
Source code that is compilable by the TNS/R native C and C++ compilers running on NonStop
S-series system is also compilable by the native PC cross compiler, except for these differences:
The default target environment for the PC cross compiler is the Guardian environment. To
produce programs that run in the OSS environment, specify the -Wsystype=oss flag to the
c89 utility.
The native C PC cross compiler supports embedded SQL. When you enable SQL, HP C passes
the SQL options you choose to cfe so that embedded SQL statements are compilable.
Additional options are required on the PC as well.
To use the C/C++ cross compiler, the source files must reside in the PC namespace. Because
the cross compiler runs on the PC, the compiler cannot see files located on NonStop server
nodes. Therefore, you must transfer your source files from the server to the PC using file transfer
protocol (FTP).
When your source files are on the PC, they can be distributed anywhere in the PC namespace.
Likewise, any files that are output from the PC cross compilers can be distributed anywhere
in the PC namespace.
PC source files with #include path names use the backslash (\) separator. These path names
are correctly interpreted by the PC cross compilers. However, PC path names cannot be used
by the native compilers that run on NonStop servers.
The PC cross compiler interprets the slash character (\) in #include path names as a
backslash (\). Therefore, OSS source files with directory names can map automatically to the
PC namespace.
The PC cross compiler handles source-file name suffixes in the same manner as c89. Source-file
names must be identified with the .suffix format just as are OSS file names. Guardian,
however, does not allow the .suffix file-name format. Therefore, Guardian file names drop
the period, and the suffix becomes the last character of the file name. However, the.suffix
format must be used when specifying the Guardian file to c89. Therefore, the Guardian file
name $VOL.SUBVOL.FILEC is specified to c89 as /G/VOL/SUBVOL/FILE.c.
Many products have shared run-time libraries (SRLs) for linking on the PC. If a product does
not have an SRL on the PC, perform final linking on a NonStop server that does have the
appropriate SRL.
Cross Compilers
Several cross compilers work with NSDEE, ETK, or TDS:
Introducing the CRE
pTAL Cross Compiler
EpTAL Cross Compiler (page 316)
COBOL85 Cross Compilers (page 317)
ETK cross compiler package is installed with an HTML help file (“Using the Command-Line Cross
Compilers on Windows”).
Native C/C++ PC Cross Compiler
Using NSDEE, ETK, or TDS, you can compile with the native C/C++ PC cross compiler, which is
essentially the same as the native C/C++ compiler available on HP NonStop servers. The NSDEE
and ETK PC cross compilers produce TNS/R native object code that runs on TNS/R servers or
Cross Compilers 315