× 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.



"mlazarus@xxxxxxxx" wrote:
> 
> >By the way, make sure you have at least one OPTIONS(*NOPASS) parameter
> in your prototype even if you always want to pass all the parameters.
> Otherwise some of your parameters won't be passed correctly.
> 
>  Can you explain why this would be?  I sems to be an odd requirement if all
> parms are being passed.

If a C prototype has ... (ellipsis), the RPG prototype has to have at
least one OPTIONS(*NOPASS) parameter - actually it probably should have
OPTIONS(*NOPASS) on the first RPG parameter that isn't listed in the C
prototype.  A ... function is a "var-args" function, which means the
parameters following the last declared parameter must be addressable
contiguously.

I believe that this rule about the parameters being addressable in
storage applies only to "primitive" parameter types (the numeric types
including single-byte char, and pointer).  I don't know what the system
does with other types passed by value like RPG's long character types.

If OPTIONS(*NOPASS) isn't coded on any parameters, the system is free to
pass some parameters in registers, but printf would not be able to see
those register parameters.

The most recent experience I've had with this was for the open()
function - the fourth parameter was not being read correctly.

If this was a surprise to you, there might be more C/RPG things that are
useful to know.  This site http://www.opensource400.org/callc.html has
most of what I know about the various gotchas.


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.