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

Table Of Contents
Mixed-Language Programming for TNS Programs
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
7-12
TAL Procedures That You Cannot Directly Call
Here are examples of interface declarations for calling TAL routines:
_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, char _far *,
short, short *, long);
_tal _alias ("tal^name") void c_name (short *);
After specifying an interface declaration, use the normal C routine call to access the
TAL routine.
This example shows a large-memory-model TNS C module that calls a TAL routine:
C Code
#include <stdioh> nolist
short arr[5]; /*stored in extended segment */
_tal _alias ("tal^name") void C_Name (short _far *);
void func1 (short *xarr)
{
C_Name (xarr);
printf ("xarr[2] after TAL = %d", xarr[2]);
}
main ()
{
arr[4] = 8;
func1 (arr);
}
TAL Code
PROC tal^name (a);
INT .EXT a; !32-bit pointer
BEGIN
a[2] := 10;
END;
TAL Procedures That You Cannot Directly Call
Your TNS C program cannot directly call a TAL procedure that both returns a value and
sets the condition code register.
To access a TAL procedure that both returns a value and sets a condition code, you
must write a “jacket” procedure in TAL that is directly callable by your TNS C program.
You define this jacket procedure so that it:
Passes arguments from C calls through to the TAL procedure unchanged