]>
git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/dlopen-in-init2.dtest/main.c
454802dc071e09ee5f9ad3140455035b28904fa3
3 // BUILD: $CC bar.c -dynamiclib -o $BUILD_DIR/libbar.dylib -install_name $RUN_DIR/libbar.dylib
4 // BUILD: $CC baz.c -dynamiclib -o $BUILD_DIR/libbaz.dylib -install_name $RUN_DIR/libbaz.dylib
5 // BUILD: $CC foo.c -dynamiclib -o $BUILD_DIR/libfoo.dylib -install_name $RUN_DIR/libfoo.dylib $BUILD_DIR/libbaz.dylib -DRUN_DIR="$RUN_DIR"
6 // BUILD: $CC main.c -o $BUILD_DIR/dlopen-in-init2.exe $BUILD_DIR/libfoo.dylib $BUILD_DIR/libbar.dylib
8 // RUN: ./dlopen-in-init2.exe
10 // This test uses dlopen to jump ahead in the initializer graph
11 // The static linkages here should result in initializers being run in the order libbaz, libfoo, libbar
12 // However, a dlopen of libbar inside libfoo's static initializer means we need to skip ahead and initialize libbar to satisfy that dlopen
13 // This means that the closure needs to have "initializer-order" on libfoo and not just the top level executable image.
14 // It also means that dlopen needs to check we have actually initialized libbar instead of just bumping its ref-count.
25 printf("[BEGIN] dlopen-in-init2\n");
30 printf("[PASS] dlopen-in-init2\n");