Using the prelinker to make your program reentrant

The prelinker concatenates compile-time initialization information (for writable static) from one or more object modules into a single initialization unit. In the process, the writable static part is mapped.

If you are not using the binder, and your program contains writable static, you can use the prelinker to make your program reentrant. If the program is C and does not contain writable static, you do not need to use the prelinker to ensure reentrancy; the program is naturally reentrant. C++ programs always contain writable static.

If you compile your code and want to link it using the z/OS® system link procedures such as IEWL, you must first call the prelinker.

The z/OS UNIX System Services features require that all z/OS XL C/C++ application programs be reentrant. If you are using the c89 utility, it automatically invokes the z/OS XL C/C++ compiler with the RENT option and also invokes the prelinker.

The prelinker is not a post-compiler. That is, you do not prelink the object modules individually into separate prelinked object modules as if running the prelinker was an extension of the compile step. Instead, you prelink all the object modules together in the same job into one output prelinked object module. This is because the prelinker cannot process each object deck one at a time: it assigns offsets to each data item in the writable static area for the program, and thus needs all of the object decks that refer to data items in writable static input in a single step.

The prelinker does all of the following:

The output of the prelinker is a single prelinked object module. You can link this object module only on the same platform where you prelinked it.

Because the prelinker maps names and removes the relocation information, you cannot use the resulting object module as input for another prelink. Also, you cannot use the linkage editor to replace a control section (CSECT) that either defines or references writable static objects.