Willy,

You don’t actually need the textlenp variable for the call to the subroutine, 
you can just pass the ADDRESS of textlen directly with this syntax:

retcode = rxhlicpl (hlicmd, name, namelen, text, &textlen);

Unless of course you also need that pointer for some other process later.

Peter

From: IBM Mainframe Discussion List <[email protected]> On Behalf Of 
Willy Jensen
Sent: Tuesday, April 16, 2024 4:14 PM
To: [email protected]
Subject: Re: How do one return a fullword binary to a C program from an 
assembler subroutine?


Found it, it was down to C pointers as expected / feared.

This works, note the use of 'textlenp' in the call:



#pragma linkage (rxhlicpl, OS)

main () {

 extern int rxhlicpl();

 int retcode;

 char hlicmd[8];

 char name[61];       /* text + eod  */

 int  *namelenp, namelen;

 char text[121];      /* text + eod  */

 int  *textlenp, textlen;

 int  retval;

-  -  -

 retcode = 0;

 strcpy (hlicmd, "VGET    ");

 strcpy (name, "TESTVAR");

 namelen = 7 ;

 textlen = 120;

 textlenp=&textlen;

 retcode = rxhlicpl (hlicmd, name, namelen, text, textlenp);

 printf("rc is %d, text is %d '%s'\n\n", retcode, textlen, text);

--



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

Reply via email to