]>
git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/static-terminators.dtest/main.c
2 // BUILD: $CC base.c -dynamiclib -install_name $RUN_DIR/libbase.dylib -o $BUILD_DIR/libbase.dylib
3 // BUILD: $CC foo.c -dynamiclib -install_name $RUN_DIR/libdynamic.dylib -o $BUILD_DIR/libdynamic.dylib $BUILD_DIR/libbase.dylib
4 // BUILD: $CC main.c -o $BUILD_DIR/static-terminators.exe -DRUN_DIR="$RUN_DIR" $BUILD_DIR/libbase.dylib
6 // RUN: ./static-terminators.exe
11 #include <mach-o/dyld_priv.h>
14 // verify all static terminators run in proper order
17 extern void mainTerminated();
19 static __attribute__((destructor
))
22 //fprintf(stderr, "main's static terminator\n");
29 printf("[BEGIN] static-terminators\n");
32 void* handle
= dlopen(RUN_DIR
"/libdynamic.dylib", RTLD_LAZY
);
33 if ( handle
== NULL
) {
34 printf("[FAIL] dlclose-static-terminator: libdynamic.dylib could not be loaded, %s\n", dlerror());
38 // PASS is printed in libbase.dylib terminator