dyld-832.7.1.tar.gz
[apple/dyld.git] / testing / test-cases / NSAddImage-basic.dtest / main.c
1 // BUILD(macos): $CC zzz.c -dynamiclib -o $BUILD_DIR/libzzz.dylib -install_name $RUN_DIR/libzzz.dylib
2 // BUILD(macos): $CC main.c -o $BUILD_DIR/NSAddImage-basic.exe -Wno-deprecated-declarations
3
4 // BUILD(ios,tvos,watchos,bridgeos):
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 #include "test_support.h"
15
16 int main(int argc, const char* argv[], const char* envp[], const char* apple[]) {
17 const char* path = argv[1];
18
19 const struct mach_header* mh = NSAddImage(path, NSADDIMAGE_OPTION_WITH_SEARCHING);
20 if ( mh == NULL )
21 FAIL("Could not load \"%s\"", path);
22 else
23 PASS("Success");
24 }
25