Charles, you will need two levels to accomplish this from Rexx. First you need a Rexx function or ADDRESS mode package written in assembler or MetalC that will load and call your C code the first time, using CEEPIPI to initialize the C environment, and save the entry point address and the address of the GETMAIN'ed CEEPIPI area in the user area of one of the Rexx control blocks or in a saved named whatchamacallit (I forget the macro name – the z/OS mechanism behind CICS named counters) for subsequent calls. And for completeness you'll probably need an "exit" call as well to clean up the loaded code and dynamic storage before Rexx termination. Something like the equivalent of a C "atexit()" function.
The problem is that z/OS Rexx has no concept of a “load this external function once and call the same copy the next time”. It sure would be nice if someone wrote generalized "loaded function" glue code for z/OS Rexx and contributed it to CBT, but sadly we do not have that yet. Peter From: IBM Mainframe Discussion List <[email protected]> On Behalf Of Charles Mills Sent: Saturday, February 28, 2026 8:56 AM To: [email protected] Subject: Is anyone familiar with CEEPIPI (LE pre-initialization)? Here's the problem I am trying to solve. I want to be able to call (from Rexx, FWIW) one or more entry points in a C++ program multiple times, and have each call after the first find the heap and statics as the previous call left them. In other words, if the Rexx called entry point A and then entry point B, on entry to B, the statics and heap would be as they were on exit from A. Will CEEPIPI let me do this? It looks to me like CEEPIPI(init_sub) will let me do this. Is that correct? CEEPIPI looks IBM-complicated, of course. Is there an easier way to accomplish what I want? Something with DLL linkage? The CEEPIPI doc talks mostly about performance. That's one of the reasons I wonder if this is the wrong approach. I "get" why pre-initialization would improve performance, and improved performance is of course a Good Thing, but that is not my primary goal. The primary goal is being able to put things in the heap and in statics and use them on subsequent calls. There would typically be half a dozen or so calls, so improving performance is not a big consideration. No, an "anchored" GETMAIN is not sufficient. The C++ code makes extensive use of library functions such as map, which is tightly integrated with the language heap. Thanks, Charles -- This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
