Simon Coulter wrote:
> 
> Problem 2 is that C expects an int (4 bytes) but the prototype is
> passing a 2-byte integer. RPG will widen the value because that's what
> C expects but you shouldn't rely on this behaviour.
> 

Actually, RPG doesn't widen the value.  Sometimes the parameter can get
passed in a register, and that makes it appear as though RPG widened the
value, but if the system doesn't have a register available, the
parameter gets passed "on the stack" (I don't know the mechanism).  When
that happens, the called function doesn't get the value that the caller
passed.

RPG does have support for widening, but it's not the default.  To
request parameter widening, you code 
   EXTPROC(*CWIDEN : 'procname')


This thread ...

Follow-Ups:
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].