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

Compiler Pragmas
HP C/C++ Programmer’s Guide for NonStop Systems429301-008
13-21
ENV
The module can be called from routines written in any language, regardless of
whether the routines run in the CRE. It is intended for system-level programming.
For additional considerations, see Section 9, System-Level Programming.
For the native C and C++ compilers, this option sets the _LIBSPACE feature-test
macro.
The pragma default settings are:
For each of the ENV pragma options, the compiler generates different code and
imposes different restrictions on which run-time library and language features can be
used. Table 13-2 summarizes the availability of run-time library and language features
for each ENV option.
Usage Guidelines
The ENV pragma is a command-line directive that can be entered on the compiler
RUN command line or be specified in the source text if it is placed before any
declarations. If you are using the c89 utility, you can specify the ENV directive with
the -Wenv flag.
Each ENV option requires certain run-time library and language features. The
Binder restricts you from binding modules with incompatible ENV options. For
details, see Restrictions on Binding Caused by the ENV Pragma on page 14-10.
Pragmas ENV EMBEDDED and ENV LIBSPACE restrict the use of C I/O functions.
Guardian I/O functions are allowed.
SYSTYPE GUARDIAN SYSTYPE OSS
TNS C compiler ENV COMMON ENV COMMON
G-series TNS c89 utility ENV COMMON ENV COMMON
TNS/R native C and C++ compilers ENV COMMON ENV COMMON
Native c89 utility ENV COMMON ENV COMMON
TNS/E native C and C++ compilers ENV COMMON ENV COMMON
Table 13-2. ENV Options and the Availability of Run-Time Library and Language
Features
COMMON EMBEDDED LIBRARY LIBSPACE
C I/O functions Yes No Yes * No
Memory allocation
functions
Yes No Yes No
Main routine Yes No No No
Relocatable data blocks Yes Yes No No
Functions that set errno Yes No Yes No
*ENV LIBRARY permits the use of high-level language I/O facilities if direct access to relocatable
data blocks is not needed for the operations.