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

LIBSPACE
specifies that the module does not require resources provided by the CRE and that it meets the
requirements to run in the user library space or system library space.
You must verify that code does not use the C run-time library and other CRE resources. The
compiler performs no verification. Specifying ENV LIBSPACE does not make code that uses
the C run-time library and other CRE resources able to run in the user library space or system
library space.
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 Chapter 9: System-Level Programming.
For the native C and C++ compilers, this option sets the _LIBSPACE feature-test macro.
The pragma default settings are:
SYSTYPE OSSSYSTYPE GUARDIAN
ENV COMMONENV COMMONTNS C compiler
ENV COMMONENV COMMONG-series TNS c89 utility
ENV COMMONENV COMMONTNS/R native C and C++ compilers
ENV COMMONENV COMMONNative c89 and c99 utilities
ENV COMMONENV COMMONTNS/E native C and C++ compilers
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 29 summarizes
the availability of run-time library and language features for each ENV option.
Table 29 ENV Options and the Availability of Run-Time Library and Language Features
LIBSPACELIBRARYEMBEDDEDCOMMONFeature
NoYes *NoYesC I/O functions
NoYesNoYesMemory allocation
functions
NoNoNoYesMain routine
NoNoYesYesRelocatable data
blocks
NoYesNoYesFunctions that set
errno
*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.
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 or the c99 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 more details, see Restrictions
on Binding Caused by the ENV Pragma (page 267).
Pragmas ENV EMBEDDED and ENV LIBSPACE restrict the use of C I/O functions. Guardian
I/O functions are allowed.
184 Compiler Pragmas