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



Thanks Barbara. The #pragma descriptor does not work when calling
procedures using a procedure pointer. Ever. Well, according to the
compiler reference, and I've never been able to make it work anyway.

"Operational descriptors are only generated for functions that are called
by their function name. Functions that are called by function pointer do
not have operational descriptors generated."

Brian, wouldn't it be neat if people who paid for a license for RDi and use
it every day could, in fact, submit bug reports? I would think so, but
alas, I am not authorized to do so.






On Thu, Jan 5, 2017 at 9:55 AM, Barbara Morris <bmorris@xxxxxxxxxx> wrote:



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