2 #include <objc/objc-runtime.h>
4 #import <Cocoa/Cocoa.h>
6 @interface Foo : NSObject
14 - (id)init { self = [super init]; x = 666; return self; }
15 - (int)get { return x; }
19 Foo * f = [[Foo alloc] init];
21 printf("%d\n", [f get]);
24 object_getInstanceVariable(f, "x", (void*)&x);
29 object_setInstanceVariable(f, "x", (void*)x);
31 printf("%d\n", [f get]);