Guardian Programmer's Guide

Table Of Contents
Using Floating-Point Formats
Guardian Programmer’s Guide 421922-014
28 - 3
Link-Time Consistency Checking
> NMC/IN SOURCEA, OUT $.#LIST/OBJECTA; IEEE_FLOAT
> NMCPLUS /IN SOURCEB, OUT $S.#LIST/OBJECTB; VERSION2, &
IEEE_FLOAT
In the above example, the native C compiler processes the file SOURCEA, and the
native C++ compiler processes the file SOURCEB. Note that the C++ compiler has
VERSION2 specified, because IEEE floating-point format is supported only under
VERSION2 C++ features.
The following is an example of linking a mixed-language program that uses IEEE
floating-point format.
> NLD $SYSTEM.SYSTEM.CRTLMAIN COBJ PTALOBJ -OBEY &
$SYSTEM.SYSTEM.LIBCOBEY -SET FLOATTYPE IEEE_FLOAT -O MYEXEC
In this example, the native C object file COBJ uses IEEE floating-point format, and the
pTAL object file uses Tandem floating-point format. (pTAL supports only Tandem
floating-point format.) To link these modules, the -set FLOATTYPE IEEE_FLOAT flag
must be specified. If this flag is not specified, nld generates error messages because
of the mismatch between Tandem and IEEE floating-point formats. When this flag is
specified, nld generates a warning message about the mismatch and builds the
executable file MYEXEC. CRTLMAIN (an object file) and the LIBCOBEY (an OBEY
file) are standard items required when linking C programs.
The nld utility can use the -set and -change flags to set or change the
float_lib_overrule attribute when creating object files. If the
float_lib_overrule attribute 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.
Link-Time Consistency Checking
The nld utility checks the consistency of floating-point type combination when linking
object files. The checking differs depending on whether or not the -set flag is
specified. When the FLOATTYPE is not explicitly set with the -set flag, nld uses the
FLOATTYPE attribute values of all the input object files for determining the
FLOATTYPE value for the output object file. If the consistency checks of the input
object files result in an invalid floating-point state or inconsistent value, an error
message is generated and no output object file is created.
Any floating type combination is allowed if you explicitly override the default with the
set FLOATTYPE flag. When the FLOATTYPE is explicitly specified with the -set flag,
nld sets the FLOATTYPE value for the output object file to that specified value. A
warning message and an output object file are generated if an inconsistency is
detected. If the floating-point state is invalid, no output object file is created.