]>
git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/dlopen-rpath-prev.dtest/main.c
2 // BUILD: mkdir -p $BUILD_DIR/dir1 $BUILD_DIR/dir2
3 // BUILD: $CC sub1.c -dynamiclib -install_name @rpath/librpathstatic.dylib -o $BUILD_DIR/dir1/librpathstatic.dylib
4 // BUILD: $CC sub2.c -dynamiclib -install_name @rpath/libdynamic.dylib -o $BUILD_DIR/dir2/libdynamic.dylib $BUILD_DIR/dir1/librpathstatic.dylib
5 // BUILD: $CC foo.c -dynamiclib -install_name $RUN_DIR/libstatic.dylib -o $BUILD_DIR/libstatic.dylib -rpath @loader_path/dir1 $BUILD_DIR/dir1/librpathstatic.dylib
6 // BUILD: $CC main.c $BUILD_DIR/libstatic.dylib -DRUN_DIR="$RUN_DIR" -o $BUILD_DIR/dlopen-rpath-prev.exe
8 // RUN: ./dlopen-rpath-prev.exe
10 // main links with libstatic.dylib which uses rpath to link with dir1/librpathstatic.dylib
11 // main dlopen()s libdynamic.dylib which links with dir1/librpathstatic.dylib, but has no rpath for it and depends on it being already loaded
18 printf("[BEGIN] dlopen-rpath-prev\n");
20 void* handle
= dlopen(RUN_DIR
"/dir2/libdynamic.dylib", RTLD_LAZY
);
21 if ( handle
== NULL
) {
22 printf("dlerror(): %s\n", dlerror());
23 printf("[FAIL] dlopen-rpath-prev\n");
27 printf("[PASS] dlopen-rpath-prev\n");