System and static object libraries

The Metal C runtime library supports two versions of its library functions: a system library and a static object library. The behavior of the functions within the two versions is the same. What differs is where the functions are located and how the Metal C application interacts with them.

System library

The system library is a version of the Metal C runtime library that exists within the system's link pack area, and is made available during the system IPL process. It is suggested that you use the system library if the Metal C application is run on a level of z/OS® that supports the runtime library, and the application runs after the library has been made available. This library has the added advantage of not requiring application module re-links when service is applied to the library.

To use the system library version, simply include the desired Metal C runtime library headers in the Metal C application source code. The default behavior of the headers is to generate code within the application that calls this system library. No additional binding is needed in order for these function calls to work.

Static object library

The Static object library is a version of the Metal C runtime library that gets directly bound with a Metal C application load module. The resulting application is self-contained with respect to the library; all library function calls from the application result in the functions bound within the load module to be driven.

It is suggested that you use the static object library if the Metal C application meets either of the following requirements:
  • The application is run on a supported level of z/OS that does not support the system library (before z/OS V1.9).
  • The application is run during system IPL before the system library has been made available.

The static object library functions are provided in two system data sets: SYS1.SCCR3BND and SYS1.SCCR6BND. SYS1.SCCR3BND is used with Metal C applications that have been compiled using ILP32 and run AMODE 31. SYS1.SCCR6BND is used with Metal C applications that have been compiled using LP64 and run AMODE 64.

In order to use the static object library, you must take the following steps:

  1. Define the __METAL_STATIC feature test macro before including the headers in your Metal C program, and then compile the program. For example:
    #define __METAL_STATIC
    #include <stdio.h>
    This will cause library function calls in the program to generate external references to the functions contained within the SCCRnBND data sets.
  2. Bind the compiled object with the corresponding SCCRnBND data set. How this is done depends on the environment in which the binding takes place:
    • Batch: When using the binder from a batch job, use the CALL option, and use the SYSLIB DD to identify the static object library data set that you want to bind with.
    • Unix System Services shell: From the shell, it is suggested that the ld shell command be used to bind the application with the library functions. This avoids conflicts with the Language Environment® stubs that the c89 family of commands may introduce. Use the -S option to identify the static object library data set that you want to bind with. For example:
      -S //"'SYS1.SCCR3BND'"
    Note: When service is applied to the static object library, the Metal C application must be re-linked to pick up the changes.

General library usage notes