C/C++ Programmer's Guide (G06.27+, H06.03+)

Table Of Contents
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
7-1
7
Mixed-Language Programming for
TNS Programs
Introducing the CRE
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-14
°
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 in the OSS file system (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.