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



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").

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

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?

As an Amazon Associate we earn from qualifying purchases.

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