• Subject: RE: c to rpg
  • From: "Bob Crothers" <bob@xxxxxxxxxxxxxx>
  • Date: Fri, 5 Jan 2001 07:24:06 -0500
  • Importance: Normal

On behalf of : Eugene Astanovsky.


The calling program can pass arguments via argv[]. But also vice
versa - whatever you place there, will be available to the calling
program on return......
You can make a simple experiment to see how it works.
Just make a C-program , that prints argv[]-s and assigns something to
them as well. Then call it from RPG and see what happens.
The only problem with "inter-language" calls I encountered so far is,
that from C point of view argv[]-s are always pointers to something,
and the called program MUST KNOW what is placed where. I wanted to
say, that I do not know any mechanism, that would allow called
C-program to understand, pointer to what particular data type is
passed to it. But this is not too dramatic.....

HTH,

Eugene Astanovsky.


-----Original Message-----
From: owner-c400-l@midrange.com [mailto:owner-c400-l@midrange.com]On
Behalf Of Brendan Bispham
Sent: Friday, January 05, 2001 5:11 AM
To: c400-l@midrange.com
Subject: c to rpg

Hi,
Im using the MATMATR example to retrieve the serial number, but I dont
understand how C returns parameters (to my RPG module):

The C program has int main(void) {

I know I can access incoming arguments with arg[] but how do I return
the
serial number (and anything else) as a parm... I think I have to
replace the
"void" with one or more parms

Has anyone got any pointers I can reference...

TIA,

nb example code i'm looking at is:
#include <QSYSINC/MIH/MATMATR>
#include <stdio.h>
 _MMTR_Template_T    machine_attributes;
 int main(void)

 machine_attributes.Options.Template_Size = 16;
  matmatr( &machine_attributes,  _MMTR_SERIAL );
   printf("Serial Number of this AS/400 is: %8.8s \n",
             machine_attributes.Options.Data.Serial );
  }

+---
| This is the C/400 Mailing List!
| To submit a new message, send your mail to C400-L@midrange.com.
| To subscribe to this list send email to C400-L-SUB@midrange.com.
| To unsubscribe from this list send email to
C400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator:
bob@cstoneindy.com
+---


+---
| This is the C/400 Mailing List!
| To submit a new message, send your mail to C400-L@midrange.com.
| To subscribe to this list send email to C400-L-SUB@midrange.com.
| To unsubscribe from this list send email to C400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: bob@cstoneindy.com
+---

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].