C/C++ Programmer's Guide (G06.25+)
Mixed-Language Programming for TNS Programs
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
7-25
Variables and Parameters
In the following example, a large-memory-model TNS C module contains C_FUNC, 
which expects a TAL procedure as a parameter. The TAL module contains:
•
An EXTERNAL procedure declaration for C_FUNC
•
TAL_PARAM_PROC, a routine to be passed as a parameter to C_FUNC
•
TAL_CALLER, a routine that calls C_FUNC and passes TAL_PARAM_PROC as a 
parameter
C Module
 /* C function that accepts TAL routine as a parameter */
void C_FUNC (short (*F) (short n))
{ 
 short j;
 j = (*F)(2); 
 /* lots of code */
}
TAL Module
PROC c_func (x) LANGUAGE C; !EXTERNAL procedure declaration 
 ! for C routine to be called
 INT PROC(32) x; !Parameter declaration 
 EXTERNAL; 
INT PROC tal_param_proc (f); !Procedure to be passed as a
 INT f; ! parameter to C_FUNC
 BEGIN
 RETURN f;
 END;
PROC tal_caller; !Procedure that calls C_FUNC
 BEGIN ! and passes TAL_PARAM_PROC
 !Lots of code
 CALL c_func (tal_param_proc);
 !Lots of code
 END;
PROC m MAIN;
 BEGIN
 CALL tal_caller;
 END;










