]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/dlopen-recurse.dtest/main.c
dyld-519.2.1.tar.gz
[apple/dyld.git] / testing / test-cases / dlopen-recurse.dtest / main.c
1
2 // BUILD: $CC bar.c -dynamiclib -install_name $RUN_DIR/libbar.dylib -o $BUILD_DIR/libbar.dylib
3 // BUILD: $CC foo.c -dynamiclib -install_name $RUN_DIR/libfoo.dylib -o $BUILD_DIR/libfoo.dylib -DRUN_DIR="$RUN_DIR"
4 // BUILD: $CC main.c -o $BUILD_DIR/dlopen-recurse.exe -DRUN_DIR="$RUN_DIR"
5
6 // RUN: ./dlopen-recurse.exe
7
8 #include <stdio.h>
9 #include <dlfcn.h>
10 #include <stdlib.h>
11 #include <dispatch/dispatch.h>
12
13
14
15 int main()
16 {
17 printf("[BEGIN] dlopen-recurse\n");
18
19 // libfoo's initializer calls dlopen(). If that hangs, we have a locking bug
20 void* handle = dlopen(RUN_DIR "/libfoo.dylib", RTLD_LAZY);
21 dlclose(handle);
22
23 printf("[PASS] dlopen-recurse\n");
24 return 0;
25 }
26