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

The older method for declaring procedures is to declare the procedure just as you would a C
function, except that you include:
A language attribute specifier (_c, _cobol, _fortran, _pascal, _tal, or
_unspecified) to identify the language of the external procedure.
An _alias attribute specifier to assign the external name, or rather the name as known to
other language.
The syntax for these older-style interface declarations is described under Attribute Specifier
(page 55). You should use the FUNCTION pragma to declare external routines.
After providing an interface declaration, your TNS C program uses normal function calls to access
the procedure written in the other language. However, remember that these calls cross language
boundaries; therefore, there are restrictions beyond those of normal C function calls.
The C interface declaration enables you to declare most types of COBOL, FORTRAN, Pascal, and
TAL procedures, including:
D-series Pascal and TAL procedures defined with the VARIABLE or EXTENSIBLE attribute
Procedures whose names are not valid C identifiers
TAL procedures that do not return a value but return a condition code
COBOL, FORTRAN, D-series Pascal, and TAL procedures with extended pointer (.EXT)
parameters
However, your TNS C program cannot directly call a TAL procedure that both returns a value and
returns a condition code. For a description of techniques that enable your TNS C program to access
TAL procedures that fall into this category, see TAL Procedures That You Cannot Directly Call
(page 105).
Usage Guidelines
Procedure names
When you specify the C name of a non-C procedure, you should use the non-C name of the
procedure if it is a valid C identifier. If the name is not a valid C identifier because it includes
circumflexes (^) or hyphens (-), simply substitute underscores (_) for the circumflexes and
hyphens in the C name.
Return value types
For procedures that return a scalar value, you should declare the C counterpart to the TAL
scalar type as the procedure type in the interface declaration. Compatible TAL and TNS C
Data Types (page 102) shows the C counterparts to TAL scalar types.
For procedures that return a condition code, you should declare _cc_status as the procedure’s
return type in the interface declaration. The tal.h header file contains three macros to interrogate
the results of the procedure declared with the _cc_status type specifier:
#define _status_lt(x) ((x) < 0)
#define _status_le(x) ((x) <= 0)
#define _status_eq(x) ((x) == 0)
#define _status_ge(x) ((x) >= 0)
#define _status_gt(x) ((x) > 0)
#define _status_ne(x) ((x) != 0)
Before you can use these macros, you must include the tal.h header file.
Note that you should avoid designing TAL procedures that return a condition code, because
that is an outdated programming practice. Guardian system procedures must retain this
interface for reasons of compatibility.
Writing Interface Declarations 99