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





Stuart Rowe wrote on Thu, 5 Jan 2017


And anyway if you think about things other than RPG, it DOES make complete
sense to use ( *omit: *nopass ) if you are planning on calling it from a C
program. *NOPASS is great from within RPG I suppose, but does not work
when calling the routine from a C module using a procedure pointer because
the "operational descriptors" are not available (the ILE environment is
not
all that integrated after all). *OMIT is better in that case as you can
pass a NULL easily from C and it appears "omitted" to RPG.

I agree that there can be reasons to have both *OMIT and *NOPASS for
parameters.

But there is a way to get operational descriptors passed from C, using
pragma descriptor.
http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/rzarf/prag_descriptor.htm

I don't know whether there's a way to have even the first parameter be
optional, though.

In this example, all parameters except the first are optional. The pragma
descriptor is only being used to get the parameter count.

int rpgproc (int *, ...);
#pragma descriptor(void rpgproc(void))

To me, not being able to describe the optional parameters is almost always
an annoying non-feature of C, so I'd actually code a separate prototype and
pragmas for each combination of parameters I wanted to pass.

int rpgproc_1 (int *);
#pragma map ( rpgproc1, "rpgproc")
#pragma descriptor(void rpgproc_1(void))

int rpgproc_3 (int *, char *, mytype *);
#pragma map ( rpgproc_3, "rpgproc")
#pragma descriptor(void rpgproc_3(void, void, void))

The pragma descriptor is only being used here to get the parameter count
passed to RPG. If you want to get real descriptors for the string
parameters, you'd code "" instead of void for those parameters.

#pragma descriptor(void rpgproc_3(void, "", void))

-- Barbara

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.