Hi James,

> I've got a problem with ILE RPG calling a procedure in ILE C. It seems
> that the return value (a character string of 4096 bytes) is being set
> properly in the C code (according to the dreaded ILE debugger), but it
> arrives completely blank in RPG (also according to the debugger). Is there
> something I need to do in the prototype for the procedure, so that RPG can
> find the return value?

Usually problems like this show up when you return a pointer from a C
function, but write your RPG prototype as if you were returning a string.

For example, if you have a C function like this:

       char *getstring(int key);

The RPG prototype must look like this:

     D getstring       PR              *   ExtProc('getstring')
     D   key                         10I 0 value

And then you call it like this:

     C                   eval      myString = %str(getstring(key))

I have a feeling that your RPG prototype looks like the following, which
will NOT work, unless the C function returns a data structure by value:

     D getstring       PR          4096A
     D   key                         10I 0 valu

If this is not the case, then please show us what your prototypes look like,
and if possible a little bit of the code, since you didn't give us much
information about how the data is being passed...

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2024 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.