|
complete
Stuart Rowe wrote on Thu, 5 Jan 2017
And anyway if you think about things other than RPG, it DOES make
Csense to use ( *omit: *nopass ) if you are planning on calling it from a
becauseprogram. *NOPASS is great from within RPG I suppose, but does not work
when calling the routine from a C module using a procedure pointer
alwaysthe "operational descriptors" are not available (the ILE environment isnot
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
an annoying non-feature of C, so I'd actually code a separate prototypeand
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
--
This is the Rational Developer for IBM i / Websphere Development Studio
Client for System i & iSeries (WDSCI-L) mailing list
To post a message email: WDSCI-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/wdsci-l.
As an Amazon Associate we earn from qualifying purchases.
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.