#include <sys/mman.h>
#include <unistd.h>
#include <fcntl.h>
+#include <Availability.h>
#include "test.h" // PASS(), FAIL()
int main()
{
+// NSObjectFileImage APIs only available on Mac OS X - not iPhone OS
+#if __MAC_OS_X_VERSION_MIN_REQUIRED
int fd = open("test.bundle", O_RDONLY, 0);
if ( fd == -1 ) {
FAIL("open() failed");
}
CheckFunc func = NSAddressOfSymbol(sym);
- if ( !func() ) {
+ if ( func == NULL ) {
FAIL("NSAddressOfSymbol failed");
return 1;
}
}
// Should check that loadAddress is unmmaped now (by call to NSDestroyObjectFileImage)
+#endif
PASS("bundle-memory-load-fat");
return 0;