|
"Bartell, Aaron L. (TC)" wrote: > > I am not sure if I should post this here or in the Java list. > > I have done a little of calling Java methods from an RPG program, but not > enough to know the answer to my question. Can RPG do a call back to a Java > method? The calling Java program must first be able to pass in a "pointer" > to the method that should be used for the call back. Then the RPG program > would make a call to that method, but would that be the same object in > memory or would it create a new one? First off can Java pass a pointer of a > method to an RPG program, and second, can RPG accept and call a pointer to a > method vs. a procedure or class? > Aaron, I don't know of any way for Java to pass a method pointer. But say you have a class C with a method m. You could have subclasses C1 and C2 with their own versions of method m, and pass RPG either a C1 or C2 object. RPG would prototype extproc(*java:'C':'m'), and the call to 'm' for a subclass C1 object would get the C1 method m(). Same as if you did this in Java: C c = new C1(); c.m(); <--- calls method m() in subclass C1
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.