This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Re: CNI and interface methods
- To: osk at hem dot passagen dot se
- Subject: Re: CNI and interface methods
- From: Tom Tromey <tromey at cygnus dot com>
- Date: Tue, 25 Jan 2000 15:26:57 -0800 (PST)
- Cc: java-discuss at sourceware dot cygnus dot com
- References: <20000125234733.A865@strix.eductussyd.se>
>>>>> "Oskar" == Oskar Liljeblad <osk@hem.passagen.se> writes:
Oskar> I read in the CNI documentation that it is not possible to call
Oskar> methods using interface references. Do I have an old egcs/gcj
Oskar> (2.95.2)? If not, any ideas when this will this be possible?
This hasn't changed -- there is no way to directly make a call from
C++ via an interface reference. As far as I know, nobody is working
on this, so I don't know when it will be possible.
Oskar> Are there any tricks to use meanwhile? I'm experimenting with
Oskar> Gtk bindings using CNI, and using interfaces for signal
Oskar> listeners is (usually) necessary.
Yeah, I like the signal/interface approach too. Are you generating
the bindings automatically from gtk.def?
Anyway, you can use _Jv_LookupInterfaceMethod to look up the method
via an interface, and then call it directly (you get back a raw
pointer which you can treat as a function pointer; be sure to pass the
object reference as the first argument). If you do this, though, be
warned that this interface isn't really exported, and we might change
it randomly.
Tom