TAL Programmer's Guide

TAL and C Guidelines
Mixed-Language Programming
096254 Tandem Computers Incorporated 17–13
Calling TAL Routines
From C Modules
A D-series C module has full access to the C run-time library even if the C module
does not contain the MAIN routine. A C-series C module that does not contain the
MAIN routine cannot fully access the C run-time library.
When you code C modules that call TAL routines:
Include an interface declaration for each TAL routine to be called.
If a called TAL routine sets the condition code, include the talh header file.
If a called routine is a system procedure, include the cextdecs header file.
In C, interface declarations are comparable to EXTERNAL procedure declarations in
TAL. To specify an interface declaration in C, include:
The keyword _tal (D-series code) or tal (C-series code)
The variable or extensible attribute, if any, of the TAL routine
The data type of the return value, if any, of the TAL routine
A routine identifier
A public name if the TAL identifier is not a valid C identifier
A parameter-type-list or, if no parameters, the keyword void
For extended pointers in the parameter-type-list, the keyword extptr before the
parameter type
The return type value can be any of the following:
Return Type Value Meaning
void The TAL routine does not return a value.
fundamental-type The TAL routine returns a value. Specify one of, or a pointer
to one of, the character, integer, or floating-point types.
cc_status The TAL routine sets the condition-code register to CCL, CCE,
or CCG (defined in talh).
For information on calling TAL routines that both return a value and set a condition
code (CC), see the C Reference Manual.
Here are examples of interface declarations for calling TAL routines. For D-series
code, prefix the tal keyword with an underscore):
_tal variable short SEGMENT_ALLOCATE_ (short, long,
short *, short);
_tal variable cc_status SEGMENT_DEALLOCATE_ (short, short);
_tal variable cc_status READ (short, short *, short,
short *, long);
_tal extensible cc_status READX (short, extptr char *, short,
short *, long);
_tal void c_name = "tal^name" (short *);
After specifying an interface declaration, use the normal C routine call to access the
TAL routine.