C/C++ Programmer's Guide (G06.25+)

Using the HP Enterprise Toolkit (ETK) and Native
C/C++ Cross Compiler on the PC
HP C/C++ Programmer’s Guide for NonStop Systems429301-008
18-5
Usage Guidelines
Usage Guidelines
The TDS version of the TNS/R native C/C++ cross compiler produces object code that
runs only on G-series systems in either the Guardian or the OSS environment.
Source code that is compilable by the TNS/R native C and C++ compilers running on
G-series systems 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).
Once 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. Thus, 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.