]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/dlopen-rpath-implicit.dtest/main.c
6d43d7f14647086c341e85bf2d0bcdd7eddceb76
[apple/dyld.git] / testing / test-cases / dlopen-rpath-implicit.dtest / main.c
1
2 // BUILD: mkdir -p $BUILD_DIR/dir1
3 // BUILD: $CC foo.c -dynamiclib -install_name @rpath/libimplicitrpath.dylib -o $BUILD_DIR/dir1/libimplicitrpath.dylib
4 // BUILD: $CC main.c -o $BUILD_DIR/dlopen-rpath-implicit.exe -rpath @loader_path/dir1
5
6 // RUN: ./dlopen-rpath-implicit.exe
7
8 #include <stdio.h>
9 #include <dlfcn.h>
10
11
12 /// test that a leaf name passed to dlopen() searches the rpath
13
14 int main()
15 {
16 printf("[BEGIN] dlopen-rpath-implicit\n");
17
18 void* handle = dlopen("libimplicitrpath.dylib", RTLD_LAZY);
19 if ( handle == NULL ) {
20 printf("[FAIL] dlopen-rpath-implicit: dlopen(libimplicitrpath.dylib) failed: %s\n", dlerror());
21 return 0;
22 }
23
24 dlclose(handle);
25
26 printf("[PASS] dlopen-rpath-implicit\n");
27
28 return 0;
29 }
30