/*
- * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2005-2009 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
*/
#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");
NSModule mod2 = NSLinkModule(ofi, "test2.bundle", NSLINKMODULE_OPTION_NONE);
if ( mod2 == NULL ) {
- FAIL("2nd NSLookupSymbolInModule failed");
+ NSLinkEditErrors c; int errorNumber; const char* fileName; const char* errorString;
+ NSLinkEditError(&c, &errorNumber, &fileName, &errorString);
+ FAIL("2nd NSLinkModule failed: %s", errorString);
return 0;
}
if ( mod == mod2 ) {
}
// check that this is really a new copy by verifying the getValue() returns zero
- NSSymbol sym4getter = NSLookupSymbolInModule(mod2, "_getValue");
+ NSSymbol sym4getter = NSLookupSymbolInModule(mod4, "_getValue");
if ( sym4getter == NULL ) {
- FAIL("2nd NSLookupSymbolInModule failed");
+ FAIL("4th NSLookupSymbolInModule failed");
return 0;
}
getter func4getter = NSAddressOfSymbol(sym4getter);
FAIL("NSDestroyObjectFileImage failed");
return 0;
}
-
+#endif
+
PASS("bundle-multi-link");
return 0;
}