]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/rpath-weak-missing.dtest/main.c
dyld-733.6.tar.gz
[apple/dyld.git] / testing / test-cases / rpath-weak-missing.dtest / main.c
1
2 // BOOT_ARGS: dyld_flags=2
3
4 // BUILD: $CC foo.c -dynamiclib -o $TEMP_DIR/libmissing.dylib -install_name @rpath/libmissing.dylib
5 // BUILD: $CC foo.c -dynamiclib -Wl,-weak_library,$TEMP_DIR/libmissing.dylib -o $BUILD_DIR/libfoo.dylib -install_name $RUN_DIR/libfoo.dylib -rpath $RUN_DIR
6 // BUILD: $CC main.c -o $BUILD_DIR/rpath-weak-missing.exe -DRUN_DIR="$RUN_DIR"
7
8 // RUN: ./rpath-weak-missing.exe
9 // RUN: DYLD_AMFI_FAKE=0 ./rpath-weak-missing.exe
10
11 // main prog dlopen()s libfoo.dylib which weak links to @rpath/libmissing.dylib
12
13 #include <stdio.h>
14 #include <dlfcn.h>
15
16
17 int main()
18 {
19 printf("[BEGIN] rpath-weak-missing\n");
20
21 void* handle = dlopen(RUN_DIR "/libfoo.dylib", RTLD_LAZY);
22 if ( handle == NULL ) {
23 printf("[FAIL] rpath-weak-missing dlopen(\"%s/libfoo.dylib\") - %s\n", RUN_DIR, dlerror());
24 return 0;
25 }
26
27 printf("[PASS] rpath-weak-missing\n");
28 return 0;
29 }
30
31