3 $C{COMPILE} -DCLASSNAME=Class1 $DIR/load-image-notification-dylib.m -o load-image-notification1.dylib -dynamiclib
4 $C{COMPILE} -DCLASSNAME=Class2 $DIR/load-image-notification-dylib.m -o load-image-notification2.dylib -dynamiclib
5 $C{COMPILE} -DCLASSNAME=Class3 $DIR/load-image-notification-dylib.m -o load-image-notification3.dylib -dynamiclib
6 $C{COMPILE} -DCLASSNAME=Class4 $DIR/load-image-notification-dylib.m -o load-image-notification4.dylib -dynamiclib
7 $C{COMPILE} -DCLASSNAME=Class5 $DIR/load-image-notification-dylib.m -o load-image-notification5.dylib -dynamiclib
8 $C{COMPILE} $DIR/load-image-notification.m -o load-image-notification.exe
16 #define ADD_IMAGE_CALLBACK(n) \
17 int called ## n = 0; \
18 static void add_image ## n(const struct mach_header * mh __unused) { \
30 objc_addLoadImageFunc(add_image1);
31 testassert(called1 > 0);
32 int oldcalled = called1;
33 void *handle = dlopen("load-image-notification1.dylib", RTLD_LAZY);
35 testassert(called1 > oldcalled);
37 objc_addLoadImageFunc(add_image2);
38 testassert(called2 == called1);
40 handle = dlopen("load-image-notification2.dylib", RTLD_LAZY);
42 testassert(called1 > oldcalled);
43 testassert(called2 == called1);
45 objc_addLoadImageFunc(add_image3);
46 testassert(called3 == called1);
48 handle = dlopen("load-image-notification3.dylib", RTLD_LAZY);
50 testassert(called1 > oldcalled);
51 testassert(called2 == called1);
52 testassert(called3 == called1);
54 objc_addLoadImageFunc(add_image4);
55 testassert(called4 == called1);
57 handle = dlopen("load-image-notification4.dylib", RTLD_LAZY);
59 testassert(called1 > oldcalled);
60 testassert(called2 == called1);
61 testassert(called3 == called1);
62 testassert(called4 == called1);
64 objc_addLoadImageFunc(add_image5);
65 testassert(called5 == called1);
67 handle = dlopen("load-image-notification5.dylib", RTLD_LAZY);
69 testassert(called1 > oldcalled);
70 testassert(called2 == called1);
71 testassert(called3 == called1);
72 testassert(called4 == called1);
73 testassert(called5 == called1);