TAL Programmer's Guide

TAL and C Guidelines
Mixed-Language Programming
17–18 096254 Tandem Computers Incorporated
Sharing TAL Data With C Using BLOCK Declarations
As of the D20 release, TAL modules can share global data with C modules by
declaring each shared variable in its own BLOCK declaration and giving both the
variable and the BLOCK the same name. The C modules must also declare each
shared variable; the layout of the variable must match in both the TAL and C modules.
In the following example, a TAL module declares a variable within a BLOCK
declaration, and the C module declares the equivalent variable:
TAL Code C Code
NAME TAL_module;
BLOCK fred;
INT .EXT fred; int FRED; /*all uppercase*/
END BLOCK;
Because the preceding method requires that the layout of the corresponding TAL and
C declarations match, it is recommended that you share data by using pointers where
possible.
Parameters and Variables This subsection gives guidelines for declaring compatible TAL and C variables and
parameters. These guidelines supplement those given in “Sharing Data” earlier in this
section. The following topics are discussed:
STRING and char variables
Arrays
Structures
Substructures
Multidimensional arrays
Arrays of structures
Redefinitions and unions
Pointers
Enumeration variables
Bit-field manipulation
UNSIGNED variables and compacted bit fields
TAL routines as parameters
C routines as parameters
When you declare formal reference parameters, remember to use indirection as
follows:
If the caller is a small-memory-model C routine, use standard indirection (.) for the
TAL formal parameter.
If the caller is a large-memory-model C routine, use extended indirection (.EXT)
for the TAL formal parameter.