z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Compiler restrictions with C applications

z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
SC27-3660-00

This topic tells you how to move your application to the z/OS® Communications Server system.

  • When you need to recompile, use the compiler shipped with this product.
  • All applications linked to the TCP/IP C sockets library must run on the LE run-time library shipped with z/OS Communications Server.
  • To access system return values, you need only use include statement errno.h supplied with the compiler. To access network return values, you must add the following include statement:
    #include <tcperrno.h>
  • To print system errors only, use perror(), a procedure available from the C compiler run-time library. To print both system and network errors, use tcperror(), a procedure provided by IBM® and included with z/OS Communications Server.

    Note to CICS® users

    Do not use tcperror(). Add statement #include <ezacichd.h> and compile the statement as non-reentrant. For more information, see the information about C Language Programming in the z/OS Communications Server: IP CICS Sockets Guide.

  • If your C language statements contain information, such as sequence numbers, that are not part of the input for the C/C++ compiler, you must exclude that information during compilation. The C/C++ compiler provides several ways to do this, one of which is:
    #pragma margins (1,72)
    In this example, we are presuming you have sequence numbers in columns 73 through 80.
  • By default, prototype C socket functions and their parameters for the current release are defined. If you need to access the TCP/IP V3R1 definitions, specify the following information during a compile:
    #define_TCP31_PROTOS
  • Use of C socket functions by routines that are a part of fetched modules or DLLs might not yield the desired results. Applications that use these C language features need to be designed so that only one copy of the API code is used within the execution environment. Also note that proper cleanup of the supporting data structures relies on the termination logic defined with the atexit() function and has all of the corresponding restrictions listed for it (see z/OS XL C/C++ Runtime Library Reference for details). Improper use will likely cause new copies of the associated data structures to be allocated in the application's address space each time the fetched module or DLL is loaded.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014