From: Panayotis K. <pan...@pa...> - 2011-05-20 06:47:33
|
First of all, thank you Arno for being for one more time helpful. On May 20, 2011, at 4:18 AM, Arno Puder wrote: > > > On 5/19/11 4:35 PM, Panayotis Katsaloulis wrote: >> I have two questions: >> >> 1) what is the reason of this variable >> >> static NSObject* dispatchObject = nil; >> >> in the NSObject class of the C backend? > > The C wrapper use this object to call the performSelectorOnMainThread: > method on a real Objective-C object. The reason I ask is because I can not find it anywhere in the code, and probably it is a leftover. >> 2) I have a JAVA_OBJECT , say "o1" >> This object, (in java) it has a specific method, let's say >> public void myMethod(Object val) {..} >> >> How do I call this method from inside C, given I have the pointer o1 of this object? > > It depends if the call is made through an interface type or class type. > I suggest that you write a mini-Java program that does this call (in > Java) and then cross-compile it with --target=posix. Then you can look > at the generated code. I want to do this in the compatibility library for arbitrary objects, in order to implement a method of an interface, so I don't know in advance what this would be. Do you believe I should use reflection then? And a last probably silly question: How do I convert an ObjC String to java_lang_String ? (and for completeness and back?) |