]>
git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/dlopen-intertwined.dtest/main.c
3 // BUILD: $CC base.c -dynamiclib -o $BUILD_DIR/libbase.dylib -install_name $RUN_DIR/libbase.dylib
4 // BUILD: $CC A.c -dynamiclib -o $BUILD_DIR/libA.dylib -install_name $RUN_DIR/libA.dylib $BUILD_DIR/libbase.dylib
5 // BUILD: $CC C.c -dynamiclib -o $BUILD_DIR/libC.dylib -install_name $RUN_DIR/libC.dylib $BUILD_DIR/libbase.dylib
6 // BUILD: $CC B.c -dynamiclib -o $BUILD_DIR/libB.dylib -install_name $RUN_DIR/libB.dylib $BUILD_DIR/libbase.dylib $BUILD_DIR/libC.dylib
7 // BUILD: $CC D.c -dynamiclib -o $BUILD_DIR/libD.dylib -install_name $RUN_DIR/libD.dylib $BUILD_DIR/libbase.dylib $BUILD_DIR/libC.dylib
8 // BUILD: $CC E.c -dynamiclib -o $BUILD_DIR/libE.dylib -install_name $RUN_DIR/libE.dylib $BUILD_DIR/libbase.dylib $BUILD_DIR/libA.dylib
9 // BUILD: $CC F.c -dynamiclib -o $BUILD_DIR/libF.dylib -install_name $RUN_DIR/libF.dylib $BUILD_DIR/libbase.dylib $BUILD_DIR/libD.dylib
10 // BUILD: $CC main.c -o $BUILD_DIR/dlopen-intertwined.exe $BUILD_DIR/libbase.dylib $BUILD_DIR/libA.dylib -DRUN_DIR="$RUN_DIR"
12 // RUN: ./dlopen-intertwined.exe
17 #include <dispatch/dispatch.h>
19 #include "test_support.h"
22 // main dlopens B which deps on C
23 // main dlopens D which deps on C
24 // main dlopens E which deps on A
25 // main dlopens F which deps on D
27 extern void a(const char*);
28 extern void setState(const char* from
);
30 int main(int argc
, const char* argv
[], const char* envp
[], const char* apple
[]) {
33 void* handle
= dlopen(RUN_DIR
"/libB.dylib", RTLD_LAZY
);
34 if ( handle
== NULL
) {
35 FAIL("Error: %s", dlerror());
38 handle
= dlopen(RUN_DIR
"/libD.dylib", RTLD_LAZY
);
39 if ( handle
== NULL
) {
40 FAIL("Error: %s", dlerror());
43 handle
= dlopen(RUN_DIR
"/libE.dylib", RTLD_LAZY
);
44 if ( handle
== NULL
) {
45 FAIL("Error: %s", dlerror());
48 handle
= dlopen(RUN_DIR
"/libF.dylib", RTLD_LAZY
);
49 if ( handle
== NULL
) {
50 FAIL("Error: %s", dlerror());