C fetching PL/I

The C fetch() function supports fetching a PL/I routine and subsequent invocation using a function pointer. The fetched PL/I routine can make additional calls (either static or dynamic) to other C routines. When a C routine issues the fetch to a load module having a PL/I entry point with statically linked C routines, the C routines might have constructed reentrancy.

When a PL/I routine is dynamically introduced into the enclave as a result of a fetch, the fetch restrictions described in the IBM Enterprise PL/I for z/OS library apply. Enterprise PL/I for z/OS® has lifted some of the fetch restrictions. For more information, see the IBM Enterprise PL/I for z/OS library.

If a PL/I procedure is to be dynamically loaded, you must specify one of the following:

The declaration of a PL/I fetched routine within a C routine is shown in Figure 1.

Figure 1. C fetching a PL/I routine
typedef int PLIFUNC();
#pragma linkage (PLIFUNC, PLI)
    .
    .
    .

PLIFUNC *fetch_ptr;
fetch_ptr = (PLIFUNC*) fetch("PLIENT");  /* fetch the routine */
fetch_ptr(args);                         /* call PLIENT       */