Re: How to find out if my app is running on PPC or i386
Re: How to find out if my app is running on PPC or i386
- Subject: Re: How to find out if my app is running on PPC or i386
- From: George Warner <email@hidden>
- Date: Tue, 13 Feb 2007 10:57:24 -0800
- Thread-topic: How to find out if my app is running on PPC or i386
>>>> What I'm asking: is there a function in Carbon to find
>>>> out on which architecture my application is running
>>>> (I386/PPC) so that i can take the proper measurements?
The optimum solution is to build the appropriate code for the appropriate
architecture. For example:
#if defined(__ppc__)
// Do PowerPC only code here
#elif defined(__i386__)
// Do Intel only code here
#endif
When you build your application Universal Binary then your macho executable
file has two executable sections: One for PowerPC and one for Intel. At
runtime the OS loads the appropriate code section depending on the
architecture of the machine that it's running on. There is no reason for
PowerPC code to be built into the Intel executable section or for there to
be any Intel code built into the PowerPC executable.
In other words, make the compiler do the work at build time rather than
executing code at runtime.
--
Enjoy,
George Warner,
Schizophrenic Optimization Scientist
Apple Developer Technical Support (DTS)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden