]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/NSAddImage-basic.dtest/main.c
dyld-421.1.tar.gz
[apple/dyld.git] / testing / test-cases / NSAddImage-basic.dtest / main.c
1 // BUILD_ONLY: MacOSX
2
3 // BUILD: $CC zzz.c -dynamiclib -o $BUILD_DIR/libzzz.dylib -install_name $RUN_DIR/libzzz.dylib
4 // BUILD: $CC main.c -o $BUILD_DIR/NSAddImage-basic.exe -Wno-deprecated-declarations
5
6 // RUN: ./NSAddImage-basic.exe $RUN_DIR/libzzz.dylib
7 // RUN: ./NSAddImage-basic.exe libzzz.dylib
8
9
10 #include <stdio.h>
11 #include <dlfcn.h>
12 #include <mach-o/dyld.h>
13
14
15 int main(int arg, const char* argv[])
16 {
17 const char* path = argv[1];
18 printf("[BEGIN] NSAddImage-basic %s\n", path);
19
20 const struct mach_header* mh = NSAddImage(path, NSADDIMAGE_OPTION_WITH_SEARCHING);
21 if ( mh == NULL )
22 printf("[FAIL] NSAddImage-basic %s\n", path);
23 else
24 printf("[PASS] NSAddImage-basic %s\n", path);
25
26 return 0;
27 }
28