]> git.saurik.com Git - apple/dyld.git/blobdiff - unit-tests/test-cases/bundle-reload/main.c
dyld-353.2.1.tar.gz
[apple/dyld.git] / unit-tests / test-cases / bundle-reload / main.c
index 1f9c3d7d279ad1f86b4488f95d59591100eb66fb..9f0f0c1244f8b9401b6b270ba75dd7691ca3b617 100644 (file)
@@ -23,6 +23,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <mach-o/dyld.h>
+#include <Availability.h>
 
 #include "test.h" // PASS(), FAIL()
 
@@ -36,6 +37,8 @@ typedef void (*fooProc)();
 // test.bundle
 void doit()
 {
+// NSCreateObjectFileImageFromMemory is only available on Mac OS X - not iPhone OS
+#if __MAC_OS_X_VERSION_MIN_REQUIRED
        NSObjectFileImage ofi;
        if ( NSCreateObjectFileImageFromFile("test.bundle", &ofi) != NSObjectFileImageSuccess ) {
                FAIL("NSCreateObjectFileImageFromFile failed");
@@ -66,14 +69,17 @@ void doit()
                FAIL("NSDestroyObjectFileImage failed");
                exit(0);
        }
+#endif
 }
 
 
 static void myRemoveImage(const struct mach_header *mh, intptr_t vmaddr_slide)
 {
+#if __MAC_OS_X_VERSION_MIN_REQUIRED
        // calling _dyld_get_image_header_containing_address() during the remove image hook 
        // could cause dyld to not flush the address->image cache
        _dyld_get_image_header_containing_address(mh);
+#endif
 }