CRE Programmer's Guide

Compiling and Linking Programs for the Native CRE
Common Run-Time Environment (CRE) Programmer’s Guide528146-004
4-2
Sourcing In CRE External Declarations for pTAL
Modules
If an env library or env libspace pragma is specified, the native C and C++
compilers place literal constants in the read-only data area and generate errors for
global variable declarations.
Use the
env pragmas as follows:
The
env pragmas also define four feature-test macros. The feature-test macros are
used in HP header files to select the function declarations appropriate for each code
space. Feature-test macros are defined as follows:
Sourcing In CRE External Declarations for
pTAL Modules
Unlike TAL routines, a pTAL routine cannot be the main procedure in a program that
runs in the CRE. The EpTAL or pTAL compiler does not establish the run-time
environment and allocate and initialize the special data blocks required by the CRE. To
work around this restriction, write a C main function that simply calls a pTAL routine.
Unlike the TAL compiler, which requires you to specify an ENV COMMON or ENV
NEUTRAL directive for programs that run in the CRE, the EpTAL or pTAL compiler
Table 4-1. env Pragma and the Availability of Features
Feature
env common env library env embedded env libspace
C run-time library and
CRE library
Yes Yes No No
User heap operations Yes Yes No No
Main routine Yes No No No
Global variable
declarations
Yes No Yes No
env Pragma Use for:
env
common User code functions that run in the CRE
env
library User library functions that run in the CRE
env
embedded User code functions that do not rely on run-time libraries; intended for
subsystems programming
env
libspace User library functions that do not rely on run-time libraries; intended
for systems programming
env common _COMMON
env library _LIBRARY
env embedded _EMBEDDED
env libspace _LIBSPACE