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

Table Of Contents
Using the Standard C++ Library
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
5-14
Using the Neutral C++ Dialect
The BUILD_NEUTRAL_LIBRARY pragma can also be specified as a flag on the c89
command line as
-Wbuild_neutral_library.
An object is neutral when the library and the application using it conform with these
rules:
The interface that the library provides uses only C linkage, or
The interface that the library provides uses C++ linkage and all the parameters in
these interfaces are marked as neutral or are strictly user-defined class types.
Only these C++ standard library interfaces are shared directly or indirectly between
the library and the user program:
°
global new operators
°
global delete operators
°
stdin, stdout, and stderr
°
errno
°
class std::exception
°
class std::bad_alloc
For example:
To create and link a library that uses the neutral C++ dialect and can be used by either
a VERSION2 or VERSION3 program, enter:
CPPCOMP / IN ZCPPCDLL, OUT $S.#LIST / mydll; SHARED, &
VERSION3, BUILD_NEUTRAL_LIBRARY
where ZCPPCDLL contains only interfaces common to both a VERSION2 and
VERSION3 program; this is the low-level Standard C++ Library. The dynamic-link
library mydll has its CPPNEUTRAL flag set for linker or loader checking.