× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Scott Klement wrote:
> ...
> But, IMHO, it's a poor practice to tell the compiler that the data is
> alphanumeric in one place and numeric in another.  Instead, either return
> a 4-byte integer in RPG, like this:
> 
>      D MYFUNCT2        PR            10U 0
>      D   arg                         15A
> 
> Or, alternately, make the C program receive a 4-byte character by value:
> 
> typedef struct structTest {
>    char val[4];
> } RetVal;
> 

In this case, it's not just poor practice.  It won't work at all if you
prototype one to return an integer and the other to return a string. 
The system handles integers ("scalar" types) and strings ("aggregate"
types) differently, so even though they're both 4 bytes, they aren't
returned the same way.  Same for passing by value.

If the C version wants to receive the result as an int, the struct would
be more useful like this:
  typedef struct structTest {
     unsigned int val;
  } RetVal;


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.