Willy,

Lots of info here, but not the essential bits:  what addressing mode and 
linkage convention would you like to use?
I'll choose to answer for 31-bit C and assembler where the assembler is 
standard savearea linkage.   This will work from either C/C++ using XPLINK or 
non-XPLINK.

In C:

int MYASM(void);
#pragma linkage (MYASM,OS_NOSTACK)
...
int answer = MYASM();

The return value is R15 from assembler.  Parameters are passed via a plist 
pointed to by R1 in the normal way.

Kirk Wolf
Dovetailed Technologies
https://coztoolkit.com

On Tue, Apr 16, 2024, at 3:14 PM, Willy Jensen wrote:
> 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);
> 
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN
> 

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to