]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/dlopen-empty-data.dtest/main.c
dyld-750.5.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 #include "test_support.h"
13
14 // libfoo-static.dylib and libfoo-dynamic.dylib each have an empty (no disk size) DATA segment
15
16 int main(int argc, const char* argv[], const char* envp[], const char* apple[]) {
17 void* handle = dlopen(RUN_DIR "/libfoo-dynamic.dylib", RTLD_LAZY);
18 if ( handle == NULL ) {
19 FAIL("libfoo-dynamic.dylib could not be loaded: %s", dlerror());
20 }
21
22 PASS("Success");
23 }
24