Hello, I've another rococoa problem.
The return type from objc_msgSend(id theReceiver, SEL theSelector,
...) is id. This seems to be roughly equivalent to VB Variant or Java
Object, now that we have autoboxing, in that it may be a pointer to an
object, or a value. However it does seem to hold the actual value of
an int by value, rather than reference.
I've mapped this like this
public interface FoundationLibrary extends Library {
Pointer objc_msgSend(Pointer receiver, Pointer selector, Object... args);
}
Where the return type from sending the message is NSObject all is
fine, but sometimes the value answered is, say, the int 1. In this
case I get a Pointer pointed at 0x00000001, and can't get the result
out of it (without parsing its toString or resorting to reflection).
If I try to return Object
Object objc_msgSend(Pointer receiver, Pointer selector, Object... args);
jna complains (reasonably) "Unsupported return type "
I've tried making an ID extends Struct, but that is marshalled all
wrong, and I can't make ID extends Pointer, as the constructors are
package private.
Is this making any sense?
So I guess the gist of what I'm asking is, is there any way to marshal
an arbitrary bit of memory, which may be a pointer, or may be 32 bits
of data?
If this isn't making any sense, sorry, its the end of long day, please
ask for clarification if you think that there's any hope.
Cheers
Duncan