Objective-C, programmatically define i386 or x86_x64 binary architecture?

Is there a way to programmatically determine / determine whether the binary (separately from my application) i386, x86_x64 or both have been compiled? I guess there is a way (obviously), although I really have no idea how to do this. Any suggestions or recommendations would be appreciated, thanks.

EDIT: I found an example on the Apple developer website, although it is written in C and configured to use it more as a command line tool. If anyone knew how to implement it in my objective-c code, that would be extremely useful.

+4
source share
2 answers
- (void)checkArchitecture { NSArray *bundleArch = [[NSBundle bundleWithPath:@"/path/to/other/bundle"] executableArchitectures]; } 
0
source

You can include mach-o headers and just load the binary and then check mach_header . You should read Apple's Mach-O format description for more information, it includes everything you need: http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/MachORuntime/Reference/ reference.html

0
source

All Articles