typedef const struct objc_selector { void *sel_id; const char *sel_types; } *SEL; typedef struct objc_object { struct objc_class* class_pointer; } *id; typedef id (*IMP)(id, SEL, ...); typedef struct objc_class *Class; struct objc_class { struct objc_method_list* methods; }; typedef void* retval_t; typedef void(*apply_t)(void); typedef union { char *arg_ptr; char arg_regs[sizeof (char*)]; } *arglist_t; typedef struct objc_method Method; typedef Method* Method_t; typedef struct objc_method_list { struct objc_method { IMP method_imp; } method_list[1]; } MethodList, *MethodList_t; Method_t class_get_instance_method(Class class, SEL aSel); int method_get_sizeof_arguments (Method*); retval_t objc_msg_sendv(id object, SEL op, arglist_t arg_frame) { Method* m = class_get_instance_method(object->class_pointer, op); return __builtin_apply((apply_t)m->method_imp, arg_frame, method_get_sizeof_arguments (m)); }