C/C++ Programmer's Guide (G06.25+)

Using the Standard C++ Library
HP C/C++ Programmer’s Guide for NonStop Systems429301-008
5-13
Using the Neutral C++ Dialect
#pragma mapinclude file "tree.cc" = "treecc"
#pragma mapinclude file "vector.cc" = "vectorcc"
#pragma mapinclude file "sys/types.h" = "systypeh"
#pragma mapinclude file "sys/stat.h" = "sysstath"
#pragma mapinclude file "hash_map" = "hashmap"
#pragma mapinclude file "hash_set" = "hashset"
#endif /* __SLMAP */
Note that this SLMAP file can be used with both VERSION2 and VERSION3.
To use the SLMAP file, enter a CPATHEQ pragma specifying the location of the
SLMAP file. For example:
#pragma cpatheq "$system.system.slmap"
For more information, including examples, about using the MAPINCLUDE and
CPATHEQ pragmas with the Rogue Wave Software products (Tools.h++ and the
Standard C++ Library), see Pragmas for Tools.h++ on page 6-6. Also see the pragmas
CPATHEQ on page 13-16 and MAPINCLUDE on page 13-61.
Using the Neutral C++ Dialect
A C++ dialect called the neutral C++ dialect, is defined for the TNS/E native
environment. This dialect, called CPPNEUTRAL, consists of library components that are
common to both VERSION2 and VERSION3 of the Standard C++ Library.
The neutral C++ dialect is used on H-series systems by system and middleware
libraries so that C++ programs using either the VERSION2 or VERSION3 Standard C++
Library can use the system and middleware libraries. You can create your own DLL
using the neutral C++ dialect so that your DLL can be similarly used by either a
VERSION2 or VERSION3 C++ program.
Two pragmas support the neutral C++ dialect:
NEUTRAL
BUILD_NEUTRAL_LIBRARY.
The NEUTRAL pragma is only allowed in C++ standard headers. This pragma marks a
class definition as being sharable between VERSION2 and VERSION3 of the Standard
C++ Library. If a class definition that is not marked as such is used within a user-
declared type or function that is marked by either the export$ or import$ specifier,
the compiler can be set to issue an error message that indicates a version-dependent
interface is used in a DLL.
The BUILD_NEUTRAL_LIBRARY pragma enables you to create a DLL that uses the
neutral dialect. This pragma can only be used when the VERSION2 or VERSION3 C++
pragma is used. The C++ compiler CPPCOMP generates an error if
BUILD_NEUTRAL_LIBRARY is specified and the program references an object not
marked as NEUTRAL in the corresponding VERSION2 or VERSION3 headers.