It is documented Combining C or C++ and Assembler programs
<https://www.ibm.com/docs/en/zos/2.5.0?topic=cc-combining-c-c-assembler-programs>
which I have used in the past
Colin

On Tue, 6 Jun 2023 at 16:27, Dave Clark <[email protected]> wrote:

>         Would someone show me an example of calling a C function from
> HLASM?  I tried asking ChatGPT and got the following.  I don't see how
> this will link from HLASM to the C function.
>
>          PRINT NOGEN
>          TITLE 'HLASM Calling ldap_open'
>
>          USING *,12
>          LR 12,15
>          LA 15,SAVEAREA
>
>          ENTRY START
>
> SAVEAREA DS 18F
>
> LDAP_OPEN EQU *
>          DROP 0
>          LR 15,13
>          BALR 14,15
>          USING LDAP_OPEN,14
>          DROP 1
>          L 1,LDAP_HOSTNAME
>          L 2,LDAP_PORT
>          L 3,LDAP_RESULT
>          BALR 14,15
>          USING LDAP_OPEN,14
>          DROP 0
>          L 15,SAVEAREA
>          RETURN (14,12),RC=0
>
> START    DS 0H
>          ...
>          ... ; HLASM code
>          ...
>          LA 1,LDAP_HOSTNAME
>          LA 2,LDAP_PORT
>          LA 3,LDAP_RESULT
>          BALR 14,15
>          USING LDAP_OPEN,14
>          ...
>          ... ; Continue with HLASM code
>          ...
>          PRINT NOGEN
>          END START
>
> Sincerely,
>
> Dave Clark
> --
> int.ext: 91078
> direct: (937) 531-6378
> home: (937) 751-3300
>
> Winsupply Group Services
> 3110 Kettering Boulevard
> Dayton, Ohio  45439  USA
> (937) 294-5331
>
>
>
>
> *********************************************************************************************
> This email message and any attachments is for use only by the named
> addressee(s) and may contain confidential, privileged and/or proprietary
> information. If you have received this message in error, please
> immediately notify the sender and delete and destroy the message and all
> copies. All unauthorized direct or indirect use or disclosure of this
> message is strictly prohibited. No right to confidentiality or privilege
> is waived or lost by any error in transmission.
>
> *********************************************************************************************
>

Reply via email to