C/C++ Programmer's Guide (G06.25+)
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
7-1
7
Mixed-Language Programming for
TNS Programs
•
Introducing the CRE on page 7-1
•
Using Standard Files in Mixed-Language Programs on page 7-3
•
Writing Interface Declarations on page 7-3
•
Interfacing to TAL on page 7-7
°
Using Identifiers on page 7-7
°
Matching Data Types on page 7-8
°
Memory Models on page 7-9
°
Data Model on page 7-9
°
Calling TNS C Routines From TAL Modules on page 7-10
°
Calling TAL Routines From TNS C Modules on page 7-11
°
Sharing Data on page 7-13
°
Variables and Parameters on page 7-17
°
Extended Data Segments on page 7-27
•
Interfacing to TNS COBOL on page 7-30
This section describes the Common Run-Time Environment (CRE) and the C interface
declarations that are necessary to interface to other programming languages. The CRE
and C interface declarations are HP features for NonStop systems that are not
available in standard ISO/ANSI C.
TNS programs in the Guardian environment can contain routines written in TNS
COBOL, FORTRAN, TAL, TNS C, and D-series Pascal. TNS programs in the OSS
environment can contain routines written in TNS COBOL, TAL, TNS C, and TNS C++.
Applications that include modules written in other languages can also be compiled in
the Guardian environment to run on OSS (see Binding a C Module
on page 14-6). For
a comparison of TNS and TNS/R native mixed-language programming, see
Differences Between Native and TNS Mixed-Language Programs
on page 8-24
Introducing the CRE
The Common Run-Time Environment (CRE) is a set of services that supports mixed-
language programs. The CRE library is a collection of routines that implements the
CRE. The CRE library enables the language-specific run-time libraries to coexist
peacefully with each other. User routines and run-time libraries call CRE library
routines to access shared resources managed by the CRE, such as the standard files
(input, output, and log) and the user heap, regardless of language.
The CRE does not support all possible operations. For example, the CRE supports file
sharing only for the three standard files: standard input, standard output, and standard