Re: Calling a variable for a procedure
Re: Calling a variable for a procedure -- Anon Post Reply Top of the thread Forum

Posted by: Jon Paris Anon, Anon
Fri, Dec 22, 2000, 11:19:18


Yes it is possible - although not quite in the way you might expect.

The answer is to use procedure pointers rather than the name itself. Remember that bound calls (which all procedure calls are) have to be resolved by the binder at compile time.

The way it works is that when you code the ExtProc keyword on the proto, you omit the quotes and instead name a procedure pointer. You then load this pointer from one initialized to the %PAddr of the procedure you want to call.

I wrote up an example for the subprocedures section of the RPG Redbook "Who knew you could ......" or you can e-mail me for a source code example. I have used this technique to give a more "OO flavor" to some of my code.


:I know I can call a program dynamically by using a variable and loading the value with whatever program I want to call. I can't seem to do the same with a procedure though. Is this possible?


Post Reply | Email Friend | Alert Original Post Top of the thread Current page