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-8
Using Link Options to Specify Floating-Point Format
using one floating-point format calls a function using the other format. Checks are
performed at process creation to ensure that the user library (if there is one) is marked
with a floattype consistent with the program file.
These combinations are considered to be conflicting and are not allowed to begin to
run:
The case in which the floattype attribute of the program file is IEEE and the user
library file is Neutral is not considered a conflict. In this case, the program is allowed to
execute, and the C/C++ run-time libraries operate in IEEE mode.
If you are using a native user library, the library file should use the same floating-point
format as the program, and the library should be marked accordingly. If the user library
doesn’t use floating point at all, you can mark the library NEUTRAL_FLOAT using the
nld or ld -set floattype or -change floattype command. Then the user
library can be used by any type of program.
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.
floattype in program file floattype in user library file
IEEE Tandem
Tandem IEEE
Neutral IEEE