]> git.saurik.com Git - apple/objc4.git/blob - test/load-reentrant2.m
objc4-781.tar.gz
[apple/objc4.git] / test / load-reentrant2.m
1 #include "test.h"
2
3 int state2 = 0;
4 extern int state1;
5
6 static void ctor(void) __attribute__((constructor));
7 static void ctor(void)
8 {
9 // should be called during One's dlopen(), before Two's +load
10 testassert(state1 == 111);
11 testassert(state2 == 0);
12 }
13
14 OBJC_ROOT_CLASS
15 @interface Two @end
16 @implementation Two
17 +(void) load
18 {
19 // Does not run until One's +load completes
20 testassert(state1 == 1);
21 state2 = 2;
22 }
23 @end