C/C++ Programmer's Guide (G06.25+)
Mixed-Language Programming for TNS/R and 
TNS/E Native Programs
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
8-17
Considerations When Interfacing to pTAL
 /* is more than one data declaring item */
 /* in the block. */
 int o = 'P' := [1, 2, 3]; extern short o [3] := {1, 2, 3};
 int p; extern short p;
end block;
block b4;
 /* Names are not changed because there */
 /* is more than one data declaring item */
 /* in the block. */
 int q = 'P' := [1, 2, 3]; extern short q [3] := {1, 2, 3};
 int .r [0:9]; extern short r [10];
end block;
block b5;
 /* Names are not changed because there */
 /* is more than one data declaring item */
 /* in the block. */
 int s = 'P' := [1, 2, 3]; extern short s [3] := {1, 2, 3};
 int t = 'P' := [1, 2, 3]; extern short t [3] := {1, 2, 3};
end block;
block e;
 /* Only one data declaring item. */
 int u; extern short e;
 int v = u;
end block;
If variable definitions are desired to be in the C++ source, remove the extern specifier 
and change the pTAL source to ?NOEXPORTGLOBALS.
Parameters and Variables
This subsection gives guidelines for declaring compatible pTAL and C variables and 
parameters. These guidelines supplement those given in Sharing Data on page 8-12. 
The following topics are discussed:
•
STRING and char Variables
•
Arrays
•
Structures
•
Multidimensional Arrays
•
Arrays of Structures
•
Redefinitions and Unions
•
Pointers
•
Enumeration Variables
•
pTAL Routines as Parameters to C
•
C Routines as Parameters to pTAL
STRING and char Variables
pTAL STRING and C char simple variables each occupies one byte of a word. Share 
variables of type pTAL STRING and C char by using pointers or declare both as int.
Arrays
pTAL and C arrays differ as follows:










