]> git.saurik.com Git - apple/objc4.git/blobdiff - test/load-reentrant2.m
objc4-437.tar.gz
[apple/objc4.git] / test / load-reentrant2.m
diff --git a/test/load-reentrant2.m b/test/load-reentrant2.m
new file mode 100644 (file)
index 0000000..78d897f
--- /dev/null
@@ -0,0 +1,22 @@
+#include "test.h"
+
+int state2 = 0;
+extern int state1;
+
+static void ctor(void)  __attribute__((constructor));
+static void ctor(void) 
+{
+    // should be called during One's dlopen(), before Two's +load
+    testassert(state1 == 111);
+    testassert(state2 == 0);
+}
+
+@interface Two @end
+@implementation Two
++(void) load
+{
+    // Does not run until One's +load completes
+    testassert(state1 == 1);
+    state2 = 2;
+}
+@end