*/
#include <stdio.h>
#include <mach-o/dyld.h>
+#include <Availability.h>
#include "test.h" // PASS(), FAIL()
int main()
{
+// 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");
}
void* func = NSAddressOfSymbol(sym);
- fprintf(stderr, "1st address of foo() = %p in module %p in OFI %p\n", func, mod, ofi);
+ //fprintf(stderr, "1st address of foo() = %p in module %p in OFI %p\n", func, mod, ofi);
NSObjectFileImage ofi2;
}
void* func2 = NSAddressOfSymbol(sym2);
- fprintf(stderr, "2nd address of foo() = %p in module %p in OFI %p\n", func2, mod2, ofi2);
+ //fprintf(stderr, "2nd address of foo() = %p in module %p in OFI %p\n", func2, mod2, ofi2);
if ( func == func2 ) {
FAIL("2nd NSAddressOfSymbol return same function address as 1st\n");
return 0;
return 0;
}
void* func3 = NSAddressOfSymbol(sym3);
- fprintf(stderr, "3rd address of foo() = %p in module %p in OFI %p\n", func3, mod3, ofi3);
+ //fprintf(stderr, "3rd address of foo() = %p in module %p in OFI %p\n", func3, mod3, ofi3);
if ( func3 == func ) {
FAIL("3rd NSAddressOfSymbol return same function address as 1st\n");
return 0;
FAIL("3rd NSDestroyObjectFileImage failed");
return 0;
}
-
+#endif
PASS("bundle-multi-load");
return 0;
}