C/C++ Programmer's Guide (G06.25+)
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
8-1
8
Mixed-Language Programming for
TNS/R and TNS/E Native Programs
•
Introducing the CRE on page 8-2
•
Using Standard Files in Mixed-language Programs on page 8-2
•
Declaring External Routines on page 8-2
•
Considerations When Interfacing to pTAL on page 8-6
°
Using Identifiers on page 8-7
°
Matching Data Types on page 8-7
°
Calling C Routines From pTAL Modules on page 8-8
°
C Routines That You Cannot Call Directly on page 8-9
°
Calling pTAL Routines From C Modules on page 8-9
°
pTAL Procedures That You Cannot Call Directly on page 8-10
°
Sharing Data on page 8-12
°
Sharing pTAL Data With C Using Pointers on page 8-13
°
Sharing C Data With pTAL Using Pointers on page 8-14
°
Sharing pTAL Data With C Using BLOCK Declarations on page 8-15
°
Sharing pTAL Global Data With C/C++ Using BLOCK Declarations on
page 8-15
°
Parameters and Variables on page 8-17
°
STRING and char Variables on page 8-17
°
Arrays on page 8-17
°
Structures on page 8-18
°
Multidimensional Arrays on page 8-19
°
Arrays of Structures on page 8-20
°
Redefinitions and Unions on page 8-20
°
Pointers on page 8-20
°
Enumeration Variables on page 8-21
°
pTAL Routines as Parameters to C on page 8-22
°
C Routines as Parameters to pTAL on page 8-23
•
Differences Between Native and TNS Mixed-Language Programs on page 8-24
•
Interfacing to Native COBOL on page 8-26
This section describes the Common Run-Time Environment (CRE) and the interface
declarations that are necessary to interface from native C or C++ to other programming
languages. The CRE and the interface declarations are HP features for NonStop
systems that are not available in standard ISO/ANSI C.
You can write native mixed-language programs targeted for either the Guardian or
OSS environments. Programs can contain routines written in native C, C++, pTAL, and