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 Systems429301-008
8-10
Considerations When Interfacing to pTAL
For information on calling pTAL routines that both return a value and set a condition
code, see pTAL Procedures That You Cannot Call Directly on page 8-10.
For examples of interface declarations for calling pTAL routines, see the Examples on
page 8-5.
For corresponding pTAL source for these first four functions, refer to 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
PROC TAL^NAME (a);
INT .EXT a; !32-bit pointer
BEGIN
a[2] := 10;
END;
pTAL Procedures That You Cannot Call Directly
Your C program cannot directly call a pTAL procedure that returns both a value and a
condition code. To access a pTAL procedure that returns both a value and a condition
Return Type Value Meaning
void The pTAL routine does not return a value.
fundamental-type The pTAL routine returns a value. Specify one of, or a pointer to
one of, the character, integer, or floating-point types.
_cc_status The pTAL routine does not return a value but does set a condition
code. The tal.h header file contains three macros that
interrogate this condition code: _status_lt(x),
_status_eg(x), and _status_gt(x).