Anybody have a sample of how to return a fullword to a C program from an 
assembler subroutine?
Apologies if this seems basic, but I really haven't looked seriously at C 
before.
I have read about 'Combining C or C++ and Assembler programs', which didn't 
help.

I have this C program (extract):
 extern int rxhlicpl();
 int retcode;          
 char hlicmd[8];       
 char name[61];   
 int  namelen;    
 char text[121];  
 int  textlen;    
. . .
 strcpy (hlicmd, "VGET    ");                                     
 strcpy (name, "TESTVAR");                                        
 namelen = 7 ;                                                    
 strcpy (text, " ");                                              
 textlen = 120;                                                   
 retcode = rxhlicpl (hlicmd, name, namelen, text, textlen);       
 printf("rc is %d, text is %d '%s'\n\n", retcode, textlen, text); 

Running the program shows: rc is 0, text is 120 'Kilroy was here yesterday'

The RXHLICPL program is an assembler subroutine which returns data to the C 
program. The char field is updated, but not the int field. I know from tracing 
the assembler subroutine that the length value is correct and not 120.
The same subroutine, except from setting the end-of-data char in the text area, 
runs in COBOL and sets the textlen field correctly.
I assume that it has something to do with C pointers, I never could get my head 
around those.

The assembler pgm (extract):
                  
ndp_blk    dsect  
ndp_cmda   ds   a 
ndp_namea  ds   a 
ndp_namela ds   a 
ndp_texta  ds   a 
ndp_textla ds   a 

         ereg  0,1   
         lr    r9,r1 
         using ndp_blk,r9
         l     r5,zrx_getdl            data size           
         l     r1,ndp_textla           -> data length field
         st    r5,0(,r1)                            

I am not using the the prolog and epilog macros as it seemed to work without, 
and I really would like to avoid LE.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to