What you need to do in C:
1. Put a #pragma linkage(assembler_routine_name,OS_NOSTACK) 2. Make sure you allocate the data areas you want to pass to your 31-bit routine using __malloc31. 3. Call a 64-bit Assembler routine, shown above as assembler_routine_name, with the parm list. 4. In the assembler routine and before the all to the 31-bit program, define the parm list for your 31-bit program. 5. Remembering that the parm list from the 64-bit C program is 64-bit addresses, move the second 4 bytes of each parm address to the parm addresses for the 31-bit program. 6. Save the 8 byte R13 coming into the assembler program 7. Do a SAM31. 8. Do a GETMAIN for 72 bytes using LOC=31 for the save area, R13, to be used for 31-bit module. 9. Save R1 that is returned so that you have 31-bit address for loading into R13. 10. Set R1 to your 31-bit parmlist. 11. Set R13 to the GETMAINed area address. 12. Load R15 with the VCON of your 31-bit routine 13. BALR to the 31-bit routine. 14. Check the return from the call. 15. If all is well, do a SAM64. 16. Restore the original 8 byte R13 17. Return to the C caller. Note: You CANNOT have mixed mode LE C code. There may be a simpler way but this works just fine. If you need more, contact me offline please. Yours truly, John T. Abell Tel: 800-295-7608 Option 4 President International: 1-416-593-5578 Option 4 E-mail: john.ab...@intnlsoftwareproducts.com Fax: 800-295-7609 International: 1-416-593-5579 International Software Products www.ispinfo.com This email may contain confidential and privileged material for the sole use of the intended recipient(s). Any review, use, retention, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive on behalf of the named recipient), please contact the sender by reply email and delete all copies of this message. Also,email is susceptible to data corruption, interception, tampering, unauthorized amendment and viruses. We only send and receive emails on the basis that we are not liable for any such corruption, interception, tampering, amendment or viruses or any consequence thereof. -----Original Message----- From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf Of Rick Troth Sent: Wednesday, April 27, 2016 9:45 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: mixed AMODE with HLL | 64-bit to 31-bit How should I call a 31-bit routine from a 64-bit routine? Obviously the 64-bit routine will have had to allocate all its storage below the bar. But what about linkage? In assembler, it's pretty well documented. What about higher level languages? To be specific, I have a chunk of C code that needs to call a 31-bit interface. It's easy to compile it for 31-bit or 64-bit, but the latter doesn't link. (No real surprise there; just disappointment.) I've looked over what docs I can find and don't see any way to cast the call or explicitly tell the compiler "we're changing AMODE for this one". Now am thinking it's either something really easy but not widely known or it's just not possible. Which is it? Thanks. For so long, z and selected other platforms are harmoniously bi-modal. Never worried about it, but now found something that isn't playing nice. Okay, so "C" might not fit the HL in HLL as much as others, but it's still LE. -- R; <>< ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to <mailto:lists...@listserv.ua.edu> lists...@listserv.ua.edu with the message: INFO IBM-MAIN --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN