IPX/SPX Programming Manual

Library Routines
HP NonStop IPX/SPX Programming Manual528022-001
5-6
Procedure Prototypes
Procedure Prototypes
Each socket function described in this manual is available to be “sourced” into TAL
programs. Either the entire set of prototypes or individual functions may be sourced.
Because TAL procedures cannot be type cast for returning pointers, those procedures
that actually do return pointers are typed as INT(32). It is the programmer’s
responsibility to redefine the returned INT(32) as a pointer to the appropriate
structure. It may be helpful for the TAL programmer to think of these pointers to
structures as pointers to arrays.
For NonStop IPX/SPX, if you wish to mix TAL code and C code to reference the socket
interface, a problem arises. As TAL interfaces only with uppercase external names, all
the socket procedure names are changed to uppercase. This is contrary to how C
modules normally reference the same entry points. To maneuver around this problem,
an “include file” named PROCRDEF is supplied with the socket library which transforms
all socket procedure names in a C module to uppercase.
Implications of the C Socket Library
TAL programs bound with the socket library differ significantly from applications written
completely in C. TAL programs miss the normal C run-time library and the normal
startup logic. The full C run-time library is replaced by a subset of minimal functions
that are used by the socket library. This means that a programmer who wishes to
combine C and TAL procedures to implement an application is bound by this same
minimal C run-time library functionality.
The TAL version of the socket library is based on the C large-memory model, so all
pointers must be 4-byte pointers.
The pTAL version of the socket library is based on the C wide-data model, so all
pointers must be 4-byte pointers.
The function provided include:
Very minimal STDIO functionality:
°
fopen
°
fgets
°
fclose
‘str...’ functionality
‘mem...’ functionality
sprintf, but not fprintf or printf
All functions implemented as macros
errno global variable
Routines available to access ‘errno’ and h_errno’ variables: