CRE Programmer's Guide

CRE Services
Common Run-Time Environment (CRE) Programmer’s Guide528146-004
2-58
CRE and RTL Prefixes
corresponding function name. See the Guardian Native C Library Calls Reference
Manual for descriptions of these functions.
CRE_ Functions
A function whose name begins with CRE_ is integral to the CRE. For example, the
CRE provides services that manage I/O, $RECEIVE, and traps. These are the services
that the CRE provides. CRE_ functions often require access to information from
previous CRE operations and save information that is used during subsequent calls to
the CRE.
RTL_ Functions
Functions whose names begin with the RTL_ prefix are included in the CRE for one of
the following reasons:
They support functionality that is required by one or more language-specific run-
time libraries.
They are context-free: their parameters specify all of their input values and they
return their results in their return values and in reference parameters. They do not
depend on calls to the operating system, to the CRE, or other environments.
They guarantee that they will return a result without causing an exception or an
error.
For example, the sine function is guaranteed to return a result regardless of the
parameter that you pass to it and does not depend on previous calls made to it.
A function needs to be available but there are no other libraries in which to store it
for general access from any HP language.
Functions With CRE_ and RTL_ Names
Some functions have two definitions that are identical except that one has a CRE_
prefix and the other an RTL_ prefix. The CRE supports the RTL_ versions for
compatibility with C-series object files and for D-series object files that do not use the
CRE. (See Section 3, Compiling and Binding Programs for the TNS CRE
, for more
details on support for C-series programs.) The CRE_ version provides optimal support
for those languages and libraries that need to take full advantage of the services of the
CRE.
For example, your program can call either of the following functions:
CRE_Arccos_Real32_
RTL_Arccos_Real32_
If the parameters you pass do not cause an error, the effect of calling either of these
functions is identical. If an error occurs while the function is computing the return value,
however—for example, an arithmetic overflow or a domain error—the CRE_ version
sets up the
errno field required for C functions, and saves the number of the error that