C/C++ Programmer's Guide (G06.25+)
Mixed-Language Programming for TNS Programs
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
7-19
Variables and Parameters
Structures
All TAL and C structures begin on a word boundary. Following are guidelines for
sharing TAL and C structures and passing them as parameters:
•
Specify the same layout for corresponding TAL and C structures.
•
Specify compatible data types for each item of both structures.
•
In TAL, pass structures by reference.
•
In C, use the & (ampersand) operator.
•
In TAL, a routine cannot return a structure as a return value.
The following TAL and C structures have compatible layouts:
TAL Code C Code
STRUCT rec (
*
); struct birdname
BEGIN {
INT x; short x;
STRING y[0:2]; char y[3];
END; } robin[10];
STRUCT .EXT robin(rec)[0:9];
The following TAL and C structures have compatible layouts:
TAL Code C Code
STRUCT rec1 (
*
); struct rec1
BEGIN {
STRING a, b, c; char a, b, c;
END; };
The following TAL and C structures also have compatible layouts:
TAL Code C Code
STRUCT rec2 (
*
); struct rec2
BEGIN {
STRING e; char e;
INT y; short y;
STRING g; char g;
END; };