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



I've handled this in the past using conditional header includes where
there's an "internal" version and an "external" version. The internal
version used a literal export symbol name, and the external version used a
pointer. The pointers are IMPORTed from a C++ module that loads the
service program (library qualified at run-time) and fills up the pointers.
All this before actual program begins running.



On Fri, Dec 16, 2016 at 6:56 AM, Mark Murphy/STAR BASE Consulting Inc. <
mmurphy@xxxxxxxxxxxxxxx> wrote:

Yes, I could, but that requires the Proc Pointer to be stored in the
global space, and rather than using the pointer in my local procedure to
execute the callback, I have to assign it to the global pointer. Obviously
not onerous, just would be convenient to not have to do that, and you still
have the issue that the Procedure interface on the callback can't use the
prototype because a procedure can't be defined for a prototype when ExtProc
is being used. The actual message is RNF1505 A procedure cannot be defined
when the prototype specifies EXTPROC(variable) or EXTPGM. Maybe the real
fix is to allow a procedure to be defined when the prototype specifies
ExtProc(variable).

Mark Murphy
Atlas Data Systems
mmurphy@xxxxxxxxxxxxxxx


-----Jon Paris <jon.paris@xxxxxxxxxxxxxx> wrote: -----
To: Rpg400 Rpg400-L <rpg400-l@xxxxxxxxxxxx>
From: Jon Paris <jon.paris@xxxxxxxxxxxxxx>
Date: 12/15/2016 04:25PM
Subject: Re: RFE for your consideration


If there needs to be debate on this Mark we can continue over on the RFE
site itself but ... the question that popped into my head was why not
include a proc pointer definition in the /Copy for the proto?


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Dec 15, 2016, at 3:36 PM, Mark Murphy/STAR BASE Consulting Inc.
<mmurphy@xxxxxxxxxxxxxxx> wrote:

I added a new RFE to add procedure templates to RPG. Here is my
justification:

When creating a prototype that references a procedure via Procedure
pointer the prototype can not be used on both the caller and the callee
side of the call. The caller needs a procedure pointer in the ExtProc
keyword, and it must be in the same scope as the pointer or you will get
compile errors. If you try to use the same prototype in the module with the
procedure interface, the pointer does not exist, and you have compile
issues. So when using procedure pointers, you have to have multiple
definitions of the same prototype which introduces the opportunity for
errors and mismatches. It would be nice if I could define a procedure
template for these situations. The template could sit in the copybook
containing my other prototypes, and then I could define local prototypes as
necessary against it with something LikeProc. Or they could opt to remove
ExtProc from the prototype or allow some sort of local override by defining
a local prototype LikePR and allowing that prototype t
o
have the ExtProc with the procedure pointer. Now that I am thinking
about it, that is probably the best option so a plain prototype sits in my
copy book to be used by procedure interfaces or calls that do not need a
procedure pointer, and a prototype that needs a procedure pointer is
defined with LikePR and allows ExtProc() with a procedure pointer.

Why use procedure pointers in the first place? They are the key to the
callback pattern. Since functions aren't first class objects in RPG, I need
to pass a procedure pointer instead of a procedure if I want an abstraction
that needs some local help in the form of a callback.

http://www.ibm.com/developerworks/rfe/execute?
use_case=viewRfe&CR_ID=98662

Mark Murphy
Atlas Data Systems
mmurphy@xxxxxxxxxxxxxxx
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD


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.