]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/rpath-weak-missing.dtest/main.c
dyld-832.7.1.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 $BUILD_DIR/libmissing.dylib -install_name @rpath/libmissing.dylib
5 // BUILD: $CC foo.c -dynamiclib -Wl,-weak_library,$BUILD_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 // BUILD: $SKIP_INSTALL $BUILD_DIR/libmissing.dylib
9
10 // RUN: ./rpath-weak-missing.exe
11 // RUN: DYLD_AMFI_FAKE=0 ./rpath-weak-missing.exe
12
13 // main prog dlopen()s libfoo.dylib which weak links to @rpath/libmissing.dylib
14
15 #include <stdio.h>
16 #include <dlfcn.h>
17
18 #include "test_support.h"
19
20 int main()
21 {
22 void* handle = dlopen(RUN_DIR "/libfoo.dylib", RTLD_LAZY);
23 if ( handle == NULL ) {
24 FAIL("rpath-weak-missing dlopen(\"%s/libfoo.dylib\") - %s", RUN_DIR, dlerror());
25 }
26
27 PASS("rpath-weak-missing");
28 }
29
30