John, if you are playing with C subroutines and you don't need anything fancy 
from the C library, try out the METALC option of the C compiler.  It generates 
HLASM code that you then assemble into a load module, so you get to see real 
assembler calling the METALC equivalents of the C library functions.

Most of the more complex METALC functions are loaded in (I think) LPA/ELPA or 
somewhere resident anyway and are accessed via a z/OS-resident vector list, so 
they (usually) don't get linked in.  Some functions are implemented with 
generated inline code (like memcpy).

Plus using the OPT, ARCH and TUNE compiler parameters allows you to take 
advantage of the C compiler's optimization code, including some pretty cool AGI 
(address generation interlock) avoidance.

Only a subset of C library functions are supported by METALC, but they are 
generally the most useful ones.

HTH

Peter

> -----Original Message-----
> From: IBM Mainframe Assembler List [mailto:ASSEMBLER-
> l...@listserv.uga.edu] On Behalf Of McKown, John
> Sent: Friday, October 14, 2011 9:33 AM
> To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
> Subject: Need simple example - Calling c subroutine like printf from HLASM
> program
>
> I know that I've seen somebody do this before. But I cannot remember how
> they did it. Does anybody have a code snippet that shows how to call a C
> subroutine like sprintf() or strncmp() from HLASM? Also the compile & link
> JCL would be appreciated. I've tried reading the LE manuals and the C
> manuals, but I'm just not finding it.
--


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.

Reply via email to