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

Table Of Contents
Compiling and Linking TNS/R Native C and C++
Programs
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
16-9
Working in the Guardian Environment
This example illustrates linking a mixed-language program that uses IEEE floating-
point format:
> ld $system.system.ccppmain cobj ptalobj -obey &
$system.system.libcobey -set floattype ieee_float -o myexec
In this example, the native C object file named COBJ uses IEEE floating-point format,
and the pTAL object file uses Tandem floating-point format. (Note that pTAL supports
only Tandem floating-point format.) To link these modules, you must specify the -set
floattype IEEE_FLOAT flag. If this flag is not specified, TNS/R native linker
generates error messages because of the mismatch between Tandem and IEEE
floating-point formats. When this flag is specified, ld generates a warning message
about the mismatch and builds the executable file MYEXEC. CCPPMAIN (an object
file) and the LIBCOBEY file (an Obey command file) are standard items required when
linking C programs. To produce non-PIC code using nld, you must specify the non-PIC
variant of CCPPMAIN, which is CRTLMAIN.
Use the -set and -change flags of the ld utility to set or change the
float_lib_overrule attribute when creating object files. If the
float_lib_overrule is specified more than once by either the -set or -change
flags, all occurrences except the last one are ignored. The float_lib_overrule
attribute can be changed only for executable files. An error occurs if an attempt is
made to change the value of this attribute for relinkable files.
For More Information
See these manuals for more details about using IEEE floating-point format:
Guardian Programmer’s Guide for information about building programs using IEEE
floating-point format
Guardian Procedure Calls Reference Manual for information about operating mode
routines and routines for converting between Tandem and IEEE floating-point
formats
The descriptions of pragmas IEEE_FLOAT on page 13-44 and TANDEM_FLOAT
on page 13-105
Working in the Guardian Environment
In the NonStop environment, you can compile and link TNS/R native programs for
either the Guardian or Open System Services (OSS) environment.
Compiling a Module
The native compilers translate the source text of a module and produce:
An extensive compiler listing. Several pragmas enable you to control the content of
this compiler listing.