C/C++ Programmer's Guide (G06.25+)

Mixed-Language Programming for TNS Programs
HP C/C++ Programmer’s Guide for NonStop Systems429301-008
7-6
Examples
The example is equivalent to the following older-style interface declaration:
_extensible _tal _alias (“CRE_ASSIGN_MAXORDINAL_”) \
get_max_assign_msg_ordinal (void);
2. This example, taken from the cextdecs header file, shows the interface
declaration for the CHANGELIST system procedure. Notice that identifier names in
the parameter type list are optional because C only cares about the types of the
parameters:
_tal _variable _cc_status CHANGELIST(short, short, short);
3. In the following example, the parameter type must be followed by the _far
specifier because the TAL parameter was declared as an extended pointer using
.EXT:
_tal _variable _cc_status PROC_3 (short _far *);
4. This example shows you how to use the _cc_status type specifier. Notice that
the variable c_code is declared as type short so that it can be compared against
the condition code that is contained in the _status_eg() macro:
_tal _cc_status _alias ("C^GETPOOL") C_GETPOOL
(short _far *pool_head,
long block_size,
long *block_addr);
short *pool_alloc(long size)
{
short c_code;
long blk_addr;
c_code = C_GETPOOL(my_pool,size,&blk_addr);
if (_status_eg(c_code))
return( (short *)blk_addr );
else
return( NULL );
}
5.The following function prototype and FUNCTION pragma:
void segment_allocate (short, long, short *, short);
...
#pragma function segment_allocate (tal, alias
(“SEGMENT_ALLOCATE_”), variable)
is equivalent to the following interface declaration:
_tal _variable short SEGMENT_ALLOCATE_ (short, long,
short *, short);