C/C++ Programmer's Guide (G06.25+)
Accessing Middleware Using HP C and C++ for
NonStop Systems
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
6-6
Pragmas for Tools.h++
Pragmas for Tools.h++
You need to use the MAPINCLUDE and CPATHEQ pragmas to map UNIX or OSS
pathnames to Guardian file names. The following examples illustrate the use of these
pragmas:
1. The pragma:
pragma MAPINCLUDE "from"="to"
tells C or C++ to modify any #include name fully matching the "from" string. The
effect is to replace the "from" string with the "to" string.
•
The following example treats #include "sys/types.h" as #include
"$system.system.systypeh":
PRAGMA MAPINCLUDE "sys/types.h"="$system.system.systypeh"
•
The following example treats #include <sys/types.h> as #include
<systypeh>:
PRAGMA MAPINCLUDE "sys/types.h"="systypeh"
This version of the pragma covers all cases where an exact match is required.
2. The pragma:
pragma MAPINCLUDE PATH "from"="to"
tells C or C++ to modify any #include name starting with the "from" string. It
replaces the "from" string with the "to" string. Note that the slash is not a delimiter;
it is part of the string.
•
The following example treats #include "rw/cstring.h" as #include
"$system.rw.cstringh":
PRAGMA MAPINCLUDE PATH "rw/"="$system.rw."
Note that cstring.h is not a Guardian file name. The compiler treats “.h” as
“h”.
•
The following example treats #include <sys/type.h> as #include
<systype.h>:
PRAGMA MAPINCLUDE PATH "sys/"="sys"
This version of the pragma handles the problem of multiple versions of class
libraries installed on a single system.
Each set of class library include files from a given vendor uses the same directory
for each class library provided. This is not a problem on small systems, because
users typically install their own copy of the version they need for their own use. On
large multiuser systems, however, it is more likely that users might want to use
different versions of a specific class library.