dyld-625.13.tar.gz
[apple/dyld.git] / testing / test-cases / dlopen-rpath-from-dylib.dtest / main.c
1
2 // BUILD: mkdir -p $BUILD_DIR/dir
3 // BUILD: $CC bar.c -dynamiclib -install_name @rpath/libbar.dylib -o $BUILD_DIR/dir/libbar.dylib
4 // BUILD: $CC test.c -dynamiclib -install_name $RUN_DIR/libtest.dylib -o $BUILD_DIR/libtest.dylib -rpath @loader_path/dir
5 // BUILD: $CC main.c -o $BUILD_DIR/dlopen-rpath-from-dylib.exe $BUILD_DIR/libtest.dylib
6
7 // RUN: ./dlopen-rpath-from-dylib.exe
8
9 #include <stdio.h>
10 #include <dlfcn.h>
11 #include <stdbool.h>
12
13
14 /// test that a call to dlopen() from a dylib uses the LC_RPATH from that dylib
15
16 extern bool test_dlopen();
17
18 int main()
19 {
20 printf("[BEGIN] dlopen-rpath-from-dylib\n");
21
22 if ( test_dlopen() )
23 printf("[PASS] dlopen-rpath-from-dylib\n");
24 else
25 printf("[FAIL] dlopen-rpath-from-dylib\n");
26
27 return 0;
28 }
29