C/C++ Programmer's Guide (G06.25+)
Compiling and Linking TNS/R Native C and C++
Programs
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
16-9
Working in the Guardian Environment
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, ld 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, you must specify the non-PIC variant of CCPPMAIN, which is
named 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 the following for more information 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-45 and TANDEM_FLOAT
on page 13-102
Working in the Guardian Environment
In the Guardian 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 the following:
•
An extensive compiler listing. Several pragmas enable you to control the content of
this compiler listing.
•
A nonexecutable object file, if the compiler encountered no errors during the
compilation.
After compiling all the modules that compose your program, you collect and combine
them into a program file (an executable object file) by using the nld utility for
conventional code or the ld utility for PIC (Position-Independent Code).