this repo has no description
1#include <stdio.h>
2#import <Foundation/NSObject.h>
3
4@interface helloclass : NSObject {
5 // We actually need to have two variables here, or the instance sizes won't match
6 // It seems that the instance size is not rounded up to 4/8 for types generated at runtime
7 @public int variable, var2;
8}
9
10- (void)doHello;
11@end
12
13@implementation helloclass
14// @synthesize variable;
15- (void)doHello
16{
17 printf("Hello world, %d\n", variable);
18}
19@end
20
21int main()
22{
23 printf("instance size: %d\n", (int) class_getInstanceSize([helloclass class]));
24 helloclass* c = [helloclass new];
25 puts("after alloc");
26 c->variable = 3;
27 puts("after ivarSet");
28 [c doHello];
29 puts("after doHello");
30 [c release];
31 return 0;
32}
33
34