]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/dlopen-empty-data.dtest/main.c
dyld-733.6.tar.gz
[apple/dyld.git] / testing / test-cases / dlopen-empty-data.dtest / main.c
1
2 // BUILD: $CC foo.c -dynamiclib -install_name $RUN_DIR/libfoo-static.dylib -o $BUILD_DIR/libfoo-static.dylib
3 // BUILD: $CC foo.c -dynamiclib -install_name $RUN_DIR/libfoo-dynamic.dylib -o $BUILD_DIR/libfoo-dynamic.dylib
4 // BUILD: $CC main.c $BUILD_DIR/libfoo-static.dylib -o $BUILD_DIR/dlopen-empty-data.exe -DRUN_DIR="$RUN_DIR"
5
6
7 // RUN: ./dlopen-empty-data.exe
8
9 #include <stdio.h>
10 #include <dlfcn.h>
11
12 // libfoo-static.dylib and libfoo-dynamic.dylib each have an empty (no disk size) DATA segment
13
14 int main()
15 {
16 printf("[BEGIN] dlopen-empty-data\n");
17
18 void* handle = dlopen(RUN_DIR "/libfoo-dynamic.dylib", RTLD_LAZY);
19 if ( handle == NULL ) {
20 printf("[FAIL] dlopen-empty-data: libfoo-dynamic.dylib could not be loaded: %s\n", dlerror());
21 return 0;
22 }
23
24 printf("[PASS] dlopen-empty-data\n");
25 return 0;
26 }
27