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

Even if the user library is marked with a floattype attribute that conflicts with the program file,
the program can use the library if it doesn’t call anything in the user library that uses floating point.
In this case, you need to mark the program file with the nld or ld -set float_lib_overrule
on command to disregard the floattype attribute of the user library file.
In fact, the run-time consistency check can be overruled by using the -set float_lib_overrule
on flag of the TNS/R native linker utility. If you overrule the consistency check, the operating
system allows a floating-point inconsistency between the user library and the program. If you do
not set float_lib_overrule, and there is an inconsistency between the program file and user
library, the operating system generates an error code and does not run the program.
Linking Mixed-Language Programs
When linking mixed-language programs that use IEEE floating-point format, specify the -set
floattype IEEE flag using the TNS/R native linker utility.
For example, if you have a mixed-language program composed of a C module that uses IEEE
floating-point format, and a COBOL module that does not use floating point but is marked by the
COBOL compiler as TANDEM_FLOAT, then you could use the ld -set floattype IEEE_FLOAT
command. Or you could first use the ld -change command to change the COBOL object file to
NEUTRAL_FLOAT.
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 (page 203) and TANDEM_FLOAT (page 251).
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.
Working in the Guardian Environment 291