How to tell when app will run in 64-bit mode?

Ben Allison benski at winamp.com
Wed Feb 6 09:03:10 PST 2008


Woops, sorry I misunderstood your question, ignore me :)  You are 
looking for a way to tell if some arbitrary binary other than yours is 
going to run in 64bit mode.

Ben Allison wrote:
> #ifdef __LP64__
> bool in_64bit = true;
> #else
> bool in_64bit = false;
> #endif
> 
> More importantly, if you have code that differs between 32bit and 64bit, 
> it is better to conditionally compile than it is to check during 
> runtime.  Remember that an 'obese-binary' is basically 4 copies of your 
> program.
> 
> -benski
> 
> Jon Gotow wrote:
>> Is there a way to determine when an 'obese-binary' application will 
>> launch in 64-bit mode?  I'm aware of Apple's 
>> CheckExecutableArchitecture sample code
>>
>>     http://developer.apple.com/samplecode/CheckExecutableArchitecture/
>>
>> but that only distinguishes between Intel and PPC.  My attempts to 
>> extend the code to check the cputype flag for x86_64 have been 
>> unsuccessful, so I'm wondering if someone's aware of a better way 
>> (please?)
>>
>>  - Jon
>>
> 
> _______________________________________________
> MacOSX-dev mailing list
> MacOSX-dev at omnigroup.com
> http://www.omnigroup.com/mailman/listinfo/macosx-dev



More information about the MacOSX-dev mailing list