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



On 10/16/06, Scott Klement <c400-l@xxxxxxxxxxxxxxxx> wrote:
Hi Steve,

> When I call an RPG procedure which has *nopass parms from ILE C how do
> I pass the %parms count to the called procedure?

To make ILE C pass %PARMS to RPG, you need to define a minimal descriptor.
RPG always passes a minimal descriptor. CL always passes the full
descriptor.  But, C doesn't do either unless you tell it to.

To tell C to pass a descriptor, use the descriptor pragma.  For example:

void MyRpgProc(int inparm, int *outparm);
#pragma descriptor (void MyRpgProc(void,void) )

The #pragma directive tells it to pass a descriptor.  However, it won't
pass it for either of the parameters, because I put "void" on the pragma
for each parameter.  So it'll only pass the parameter count with nothing
else (that's what I mean when I say "minimal").

that did it Scott. Thanks.

For more info, look up #pragma descriptor in the manuals :)

with my reading comprehension deficit, that would be a challenge ...

> I am trying to switch to C++ and use function overloading but that
> means I cant use extern "C" on the function prototype. Without extern
> "C" I get a mangled name for each function overload. How do I map
> those different mangled names to the single exported procedure from
> the RPG module?

RPG doesn't understand overloading, and if it ever does, I have a feeling
they won't use name mangling to accomplish it (just a guess, mind you).

If you wanted to write overloaded functions in RPG, you'd have to give
them all different names.  I suppose you COULD mangle the names manually
so that C++ could use them as overloaded procs...  but I'm not sure if
it's a good idea.

Was this just an alternate approach to getting %PARMS to work?  Or do you
really need mangled names in RPG?

just hoping C++ would pass a parm count. for example, if the C++
module used two overloads of a function then on the CRTPGM step the
linker would be looking for two different unresolved export names. One
for each overload used in the CPP module. I was hoping there was a way
to map those two names to the single RPG procedure that I wanted to be
called. Kind of like if you could specify more than one "extproc("
name for a procedure prototype.

thanks again,

-Steve

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.