Accessing objective-c from c
Accessing objective-c from c
- Subject: Accessing objective-c from c
- From: James Howard <email@hidden>
- Date: Thu, 29 May 2003 22:56:25 -0700
I've been playing around with unsanity's ape sdk lately. Its pretty
cool, but to do anything complex it requires that I make a lot of
objective-c calls from c. I've figured out how to send and get return
values for all of the possible objective-c message types except for
those methods that return just a plain int or something. When a
structure is the return value, I can do something like this:
NSRect rect;
objc_msgSend_stret(&rect, someView, sel_registerName("frame"));
and that gets me the rect all well and good. (that would be equivalent
to NSRect rect = [someView frame];)
But lets say I want to get an int (int level = [someWindow level];)
int level;
objc_msgSend_stret(&level, someWindow, sel_registerName("level"));
and that won't work at all. I think it might be doing something like
sticking the return value into an objc_ivar struct or something to that
effect, but I haven't been able to track it down to the point where I
get anything that works. So what is the magic combination I need to
get the int return value?
- James Howard
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.