TCP/IP Programming Manual
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.
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 functions 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:
INT PROC get_errno;◦
◦ INT PROC get_h_errno;
These restrictions imply that the following features are not available in the C run-time library subset:
• _MAIN, that is, startup processing, general initialization.
• Heap management ('malloc', 'calloc', 'realloc’, 'free') is available only through the
Common Run-Time Environment (CRE) user heap management routines. Refer to the CRE
Programming Manual for details.
If mixed TAL and C code has a TAL MAIN section, the restricted set of functions just listed applies.
If mixed TAL and C code having a C _main is used, full C run-time library functionality is available.
Usage/Bind Considerations
The following steps summarize the TAL usage and bind considerations in a CRE environment:
1. All addresses must be 32 bits (.EXT).
2. Source SOCKPROC to reference socket library procedures.
Interfacing TAL Programs to the Socket Library 87