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

Table Of Contents
Compiler Pragmas
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
13-107
VERSION1
Usage Guidelines
As of G06.20, the default for native mode C++ compilation is VERSION3 (not
VERSION1). If you are going to recompile an application that used the previous
default (VERSION1), you must specify the VERSION1 pragma. See also
VERSION2 on page 13-108 and VERSION3 on page 13-110.
You can enter the VERSION1 directive on the compiler RUN command line when
specifying NMCPLUS on Guardian environment, or using the -Wversion1 flag
when specifying c89 On OSS environment. You cannot enter the VERSION1
directive in the source file.
All modules of an application must be built using the same version of the Standard
C++ Library. For example, you must compile all modules using the same version
directive (VERSION1, VERSION2, or VERSION3). Mixing versions within an
application can cause unpredictable results. Additionally, the linkers and the
NonStop OS perform version checking. Attempting to mix VERSION3 with either of
the other versions will yield an error (for link files) or a warning (for load files) from
the linker, and a run-time error at load time from the NonStop OS.
Using the VERSION1 directive with the D45 (or later) native C++ compiler produces
an object file that is compatible with an object file produced by the D40 native C++
compiler but not compatible with an object file produced by the D45 (or later) native
C++ compiler using the VERSION2 or VERSION3 directives.
New C++ features introduced at the D45 RVU mean that objects compiled to take
advantage of these features are incompatible with objects produced using earlier
versions of the compiler.
Moreover, object files produced by the D45 C++ compiler using the default at D45
(VERSION1) are not binary compatible with object files produced by the D45 C++
compiler using the VERSION2 directive or with object files produced by the G06.20
C++ compiler using the default, VERSION3.
The nld linker issues an error or warning if you attempt to link several C++
modules that were compiled with different version directives. You can use the eld
or ld linker only with VERSION2 or VERSION3.
VERSION1 does not support the IEEE floating-point format for performing floating-
point arithmetic.
VERSION1 does not support Position-Independent Code (PIC) or the use of DLLs.
In the G06.20 RVU, all the native C++ header files have been combined into one
product number (T2824). These headers have been modified to identify the version
used in the compile and to redirect calls to the correct library.
If you include the RUNNABLE option when compiling VERSION1 on Guardian
environment (or if you do not include -c On OSS environment), the compiler
automatically links:
°
ZCPLGSRL (Guardian C++ library) or ZCPLOSRL (OSS C++ library)