Question

Can anybody give me some examples of Mach-O files in an Xcode project, or any framework's Mach-O file?

Was it helpful?

Solution

If you build an example app for the Macintosh, step into the "Contents" and then the "MacOS" directories.

When you type in "nm" and then the name of the binary file, you'll see a list of symbols available in your computer's native architecture (whether it be 32-bit Intel or 64-bit Intel). That's one of the benefits of the Mach Object File Format.

Here's an example when I looked at the (two or three) symbols from the Cocoa framework:

[HiThere]:;nm /System/Library/Frameworks/Cocoa.framework/Versions/Current/Cocoa
0000000000000ff8 S _CocoaVersionNumber
0000000000000fa0 S _CocoaVersionString
                 U dyld_stub_binder

You can also display the symbols for other architectures available in the Mach-O format, like ppc or i386 or x86_64 or ppc64 (if it was compiled, that is).

Here is more information from Wikipedia.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top