]>
git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/dlopen-iOSMac.dtest/main.c
1 // BUILD(macos): $CC main.c -o $BUILD_DIR/dlopen-iOSMac.exe -DFOR_IOSMAC=1 -target x86_64-darwin-ios13.0-macabi
2 // BUILD(macos): $CC main.c -o $BUILD_DIR/dlopen-macOS.exe -DRUN_DIR="$RUN_DIR"
3 // BUILD(macos): $CC cat.c -dynamiclib -install_name $RUN_DIR/libcat.dylib -o $BUILD_DIR/libcat.dylib -target x86_64-darwin-ios13.0-macabi
4 // BUILD(macos): $CC foo.c -dynamiclib -install_name $RUN_DIR/libtestnotincache.dylib -o $BUILD_DIR/libtestnotincache.dylib $BUILD_DIR/libcat.dylib
5 // BUILD(macos): $CC foo.c -dynamiclib -install_name $RUN_DIR/libtestincache.dylib -o $BUILD_DIR/libtestincache.dylib -framework UIKit -F/System/iOSSupport/System/Library/Frameworks
7 // BUILD(ios,tvos,watchos,bridgeos):
9 // RUN: ./dlopen-iOSMac.exe
10 // RUN: ./dlopen-macOS.exe
15 #include <mach-o/dyld.h>
17 #include "test_support.h"
19 int main(int arg
, const char* argv
[])
23 void* handle
= dlopen("/System/Library/Frameworks/UIKit.framework/UIKit", RTLD_LAZY
);
24 if ( handle
== NULL
) {
25 FAIL("dlopen-iOS-on-Mac, UIKit failed to dlopen(): %s", dlerror());
29 void* handle
= dlopen("/System/Library/Frameworks/AppKit.framework/AppKit", RTLD_LAZY
);
30 if ( handle
== NULL
) {
31 FAIL("dlopen-macOS, AppKit failed to dlopen(): %s", dlerror());
34 // verify that can't load a macOS dylib that links with a catalyst dylib
35 handle
= dlopen(RUN_DIR
"/libtestnotincache.dylib", RTLD_LAZY
);
36 if ( handle
!= NULL
) {
37 FAIL("dlopen-macOS, libtestnotincache.dylib should not be loaded");
40 // verify that can't load a macOS dylib that links with a catalyst dylib which is in the dyld cache
41 handle
= dlopen(RUN_DIR
"/libtestincache.dylib", RTLD_LAZY
);
42 if ( handle
!= NULL
) {
43 FAIL("dlopen-macOS, libtestincache.dylib should not be loaded");
49 PASS("dlopen-iOS-on-Mac");