CRE Programmer's Guide
Compiling and Binding Programs for the TNS CRE
Common Run-Time Environment (CRE) Programmer’s Guide—528146-004
3-4
Sourcing-in CRELIB Function Declarations
The C compilers generate programs that run in the CRE. The TNS COBOL,
FORTRAN, and TAL compilers generate programs that can run in either a language-
specific run-time environment or the CRE. To produce TNS COBOL, FORTRAN, or
TAL programs that run in the CRE, you must compile with the ENV COMMON
directive. To produce TNS COBOL, FORTRAN, or TAL programs that run in language-
specific run-time environments, you must compile with the ENV OLD directive or
without any ENV directive.
You can specify an ENV directive either in a compilation command or in the program
source code before any declarations. For example, the following compilation command
produces a TAL object file compiled for the CRE:
TAL / IN source, OUT listing / ; ENV COMMON
Compiling TAL Programs for the CRE
TAL routines compiled with the ENV NEUTRAL directive can be bound into a program
that runs in either the CRE or a language-specific run-time environment. However, a
TAL routine compiled with the ENV NEUTRAL directive cannot be the main procedure
in a program that runs in the CRE because the TAL compiler only allocates and
initializes the special data blocks required by the CRE when the main routine is
compiled with the ENV COMMON directive.
For a program with a TAL main procedure to run in the CRE, the program must make
explicit calls to CRE functions for initialization, input/output, and so on. In all the other
languages, the CRE is almost invisible to you. Refer to the
TAL Programmer’s Guide
for details on writing TAL programs that use the CRE.
Sourcing-in CRELIB Function Declarations
CRELIB contains the CRE library functions documented in Section 5, Using the
Common Language Utility (CLU) Library,Section 6, CRE Service Functions,and
Section 7, Math Functions
. If your TAL routines call CRE library functions whose
names begin with CRE_, you must compile the routines with a SOURCE directive that
references CREDECS, the external declarations file for the CRE library functions.
Likewise, if your TAL routines call functions whose names begin with RTL_, you must
compile the program with a SOURCE directive that references RTLDECS, the external
declarations file for the RTL_ functions.
CREDECS and RTLDECS are located in $SYSTEM.SYSTEM by default. Each
declaration is placed within a TAL SECTION directive. Some declarations in
CREDECS and RTLDECS contain TAL BLOCK statements to declare global data
blocks. Your program should read the source code from only those sections of the files
that contain declarations you need in your program. Programs that use these
declarations must follow the coding guidelines for BLOCK declarations. Refer to the
TAL Programmer’s Guide for details.