C/C++ Programmer's Guide (G06.27+, H06.08+, J06.03+)

Specifying a FUNCTION Pragma
To declare an external routine by using a function prototype and a FUNCTION pragma, include:
The keyword _tal
The variable or extensible attribute, if any, of the pTAL routine
A public name if the pTAL identifier is not a valid C identifier
Specifying an Interface Declaration
To declare an external routine by using an interface declaration, include:
The keyword _tal
The variable or extensible attribute, if any, of the pTAL routine
The data type of the return value, if any, of the pTAL routine
An identifier for the pTAL routine
A public name if the pTAL identifier is not a valid C identifier
A parameter-type list or, if no parameters, the keyword void
The return type value can be any of these:
MeaningReturn Type Value
The pTAL routine does not return a value.void
The pTAL routine returns a value. Specify one of, or a pointer to one of, the
character, integer, or floating-point types.
fundamental-type
The pTAL routine does not return a value but does set a condition code. The
tal.h header file contains six macros that interrogate this condition code:
_cc_status
_status_lt(x), _status_le(x), _status_eq(x), _status_ge(x),
_status_gt(x), and _status_ne(x).
For information on calling pTAL routines that both return a value and set a condition code, see
pTAL Procedures That You Cannot Call Directly.
For examples of interface declarations for calling pTAL routines, see Examples (page 124).
For corresponding pTAL source for these first four functions, see the Guardian Procedure Calls
Reference Manual or the EXTDECS file.
After specifying an interface declaration, use the normal C routine call to access the pTAL routine.
This example shows a C module that calls an pTAL routine:
C Code
#include <stdioh> nolist
short arr[5]; /*stored in extended segment */
_tal _alias ("TAL^NAME") void C_Name (short *);
void func1 (short *xarr)
{
C_Name (xarr);
printf ("xarr[2] after TAL = %d", xarr[2]);
}
main ()
{
arr[4] = 8;
func1 (arr);
}
pTAL Code
128 Mixed-Language Programming for TNS/R and TNS/E Native Programs