When XPLINK should not be used

Functions compiled XPLINK and NOXPLINK cannot be combined in the same program object (except when the #pragma linkage(OS) directive is used in C, or extern in C++; see z/OS V2R1.0 Language Environment Writing Interlanguage Communication Applications for more information).

While XPLINK can provide a significant performance enhancement to the right application, it can also degrade the performance of an application that is not suitable for XPLINK.

One way to call an XPLINK function from non-XPLINK is to use the DLL call mechanism. But there is an overhead cost associated with calls made from non-XPLINK to XPLINK, and from XPLINK to non-XPLINK. This overhead includes the need to swap from one stack type to another and to convert the passed parameters to the style accepted by the callee. Applications that make many "cross-linkage" calls might lose any benefit obtained from the parts that were compiled XPLINK, and in fact performance could be degraded from the pure non-XPLINK case. If the number of pure XPLINK function calls is significantly greater than the number of "cross-linkage" calls, then the cost saved on XPLINK calls will recover some of the costs associated with calls that involve stack swapping.

When you introduce an XPLINK program object into your application, for example an XPLINK version of a vendor-DLL which your application uses, then your application must now run in an XPLINK environment (this is controlled by the XPLINK runtime option). In an XPLINK environment, an XPLINK version of the C/C++ runtime library (RTL) is used. You cannot have both the non-XPLINK and XPLINK versions of the C/C++ RTL active at the same time, so in an XPLINK environment, non-XPLINK callers of the C/C++ runtime library also incurs this stack swapping overhead.

The maximum performance improvement can be achieved by recompiling an entire application XPLINK. The further the application gets from pure XPLINK, the less the performance improvement, and at some point you might see a performance degradation.

The only compiler that supports the XPLINK compiler option is the z/OS XL C/C++ compiler. All COBOL and PL/I programs are non-XPLINK, and therefore calls between COBOL or PL/I and XPLINK-compiled C/C++ are cross-linkage calls and will incur the stack swapping overhead. For more information about making ILC calls with XPLINK, see z/OS V2R1.0 Language Environment Writing Interlanguage Communication Applications.

If the application contains C or C++ and the XPLINK(ON) runtime option is specified, then the XPLINK-compiled version of the C runtime library (RTL) is loaded, which will run on the downward-growing stack. When non-XPLINK functions call C RTL functions in this environment, a swap from the upward-growing stack to the downward-growing stack will occur. This results in additional overhead that could cause a performance penalty. Applications that make heavy use of the C RTL from non-XPLINK callers should be aware of this, and if necessary for performance reasons, either run in a pure non-XPLINK environment with XPLINK(OFF) (the default in this case), or convert as much of the application to XPLINK as possible and run with XPLINK(ON).

Applications that use Language Environment environments that are not supported in an XPLINK environment, or that use products that are not supported in an XPLINK environment (for example, CICS® before CICS TS 3.1), cannot be recompiled as XPLINK applications.