#import // gcc -g -Wall -framework Foundation -o sel sel.m @interface ObjectCallback : NSObject - (void)callback; @end @implementation ObjectCallback - (int) groovyness { return 23; } - (void)callback { NSLog(@"My spoon is too big %d", [self groovyness]); } @end typedef void (*C_callback)(void); int main (void) { ObjectCallback *cb = [[ObjectCallback alloc] init]; [cb callback]; IMP method = [cb methodForSelector:@selector(callback)]; // This is what the C library would be doing. C_callback c_function = (C_callback)method; c_function(); return (0); } // main