> you can embed inline assembly instructions in C/C++ programs

@Jonathan, in C programs only, not C++ -- correct?

Charles


-----Original Message-----
From: IBM Mainframe Assembler List [mailto:[email protected]]
On Behalf Of Jonathan Scott
Sent: Monday, January 29, 2018 6:09 AM
To: [email protected]
Subject: Re: Fair comparison C vs HLASM

Ref:  Your note of 29 January 2018, 07:49:23 -0500

Someone wrote:
> For this topic, it doesn't matter whether it's C or Metal C.

>From z/OS XL C/C++ V2.1.1, you can embed inline assembly instructions in
C/C++ programs without having to use Metal C, and those instructions can
include system macros.

The C/C++ compiler invokes HLASM (at APAR level PI21235 or above) to
assemble a source file containing all of the fragments, with the source
provided in main storage and the binary object code returned in main storage
(using HLASM exits), then the binary code fragments are embedded at the
appropriate points in the C object code.

There are various restrictions, in that for example no relocatable address
constants are allowed, but macros are allowed.  Each inline code fragment is
defined to HLASM as a separate CSECT (which makes it easy to pick out the
binary code for that fragment from the overall object output, and also
reduces the risk of assembly-time dependencies between separate fragments).

Reply via email to