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 Systems—429301-008
8-24
Differences Between Native and TNS Mixed-
Language Programs
pTAL Module
INT i;
STRING .EXT s[0:9];
PROC c_param_func (i, s) !EXTERNAL procedure declaration
 LANGUAGE C; ! for C routine expected as 
 INT i; ! a parameter
 STRING .EXT s; !Extended indirection for large-
 EXTERNAL; ! memory-model 
PROC tal_proc (x); !pTAL routine that expects
 PROC x; ! a C routine as a parameter
 BEGIN 
 CALL x (i, $XADR (s));
 END;
PROC tal_caller;
 BEGIN
 CALL tal_proc (c_param_func);
 END;
PROC m main;
 BEGIN
 CALL tal_caller;
 END;
C Module
void C_PARAM_FUNC (short i, char * s)
{ /* C routine to be passed as */
 /* a parameter to TAL_PROC */
}
When you pass a C routine as a parameter, the compiler passes a 32-bit address that 
contains PEP and map information in the high-order word and a zero in the low-order 
word. 
Differences Between Native and TNS Mixed-
Language Programs
The information in this section is for writing mixed-language native C or C++ programs. 
If you need to write mixed-language native C or C++ programs that can run as both 
TNS and native processes, you need to also read Section 7, Mixed-Language 
Programming for TNS Programs.
To write mixed-language programs that run as both TNS and native processes, you 
need to consider at least these issues:
•
Data models
•
Memory models
•
_far Pointer Qualifier
•
Extended data segments










