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

Mixed-Language Programming for TNS Programs
HP C/C++ Programmer’s Guide for NonStop Systems429301-008
7-2
Introducing the CRE
log. The language-specific run-time libraries access all other files by calling Guardian
system procedures directly, whether or not a program uses the CRE.
C-series programs run in a language-specific run-time environment. D-series C and
Pascal programs run only in the CRE. D-series COBOL, FORTRAN, and TAL
programs can run in either their language-specific run-time environments or the CRE.
All of the routines in a program must be compiled to run in either a language-specific
run-time environment or the CRE.
Table 7-1, lists the C-series and D-series run-time environments available for each
language.
The language of a program’s main routine determines the program’s run-time
environment. (The main routine is the routine that executes first in your program; it is
the routine declared with the main keyword, or in some languages the PROGRAM
keyword.)
If a program does not use the CRE, routines written in a language other than that
of the main routine have limited access to their run-time libraries. For example, if:
°
The main routine of a mixed-language program is written in COBOL
°
The program runs in a language-specific run-time environment (the COBOL
run-time environment)
then a C routine has limited access to the TNS C run-time library.
If a program uses the CRE, each routine in the program appears to be running in
its own language-specific run-time environment, regardless of the language of the
main routine. For example, if:
°
The main routine of a mixed-language program is written in COBOL
°
The program runs in the CRE
then a C routine has complete access to the TNS C run-time library.
D-series TNS C and Pascal run-time libraries always call CRE library routines for
services managed by the CRE; they can run only in the CRE. D-series TNS COBOL
and FORTRAN run-time libraries call CRE library routines if you compile all the
Table 7-1. Run-Time Environments Available
Language C-Series Environment D-Series Environments
C C run-time environment CRE
COBOL COBOL run-time
environment
CRE or COBOL run-time
environment
FORTRAN FORTRAN run-time
environment
CRE or FORTRAN run-time
environment
D-series Pascal Pascal run-time environment CRE
TAL No run-time environment CRE or no run-time environment