]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/dlopen-framework-fallback.dtest/main.c
dyld-625.13.tar.gz
[apple/dyld.git] / testing / test-cases / dlopen-framework-fallback.dtest / main.c
1
2 // BUILD: $CC main.c -o $BUILD_DIR/dlopen-framework-fallback.exe
3
4 // RUN: ./dlopen-framework-fallback.exe
5
6 #include <stdio.h>
7 #include <dlfcn.h>
8
9
10
11 int main()
12 {
13 printf("[BEGIN] dlopen-framework-fallback\n");
14
15 // Verify dyld will fallback and look for framework in /System/Library/Frameworks/
16 void* handle = dlopen("/System/Library/BadPath/CoreFoundation.framework/CoreFoundation", RTLD_LAZY);
17 if ( handle == NULL ) {
18 printf("dlerror(): %s\n", dlerror());
19 printf("[FAIL] dlopen-framework-fallback\n");
20 return 0;
21 }
22
23 // validate handle works to find symbols
24 void* sym = dlsym(handle, "CFRetain");
25 if ( sym == NULL ) {
26 printf("dlerror(): %s\n", dlerror());
27 printf("[FAIL] dlopen-framework-fallback\n");
28 return 0;
29 }
30
31 printf("[PASS] dlopen-framework-fallback\n");
32
33 return 0;
34 }
35