Re: programmatically determining if the machine is intel or not
Re: programmatically determining if the machine is intel or not
- Subject: Re: programmatically determining if the machine is intel or not
- From: Shaun Wexler <email@hidden>
- Date: Wed, 17 May 2006 14:43:53 -0700
On May 17, 2006, at 4:53 AM, Jonathan Sand wrote:
Does anyone know of a way to programmatically determine whether
ones Mac code is running on PowerPC or Intel hardware?
#import <sys/sysctl.h>
BOOL SKWLaunchedByRosettaHeuristic(void)
{
#ifndef __i386__
int mib[2] = { CTL_HW, HW_MODEL };
char model[32];
size_t len = sizeof(model);
if (sysctl(mib, 2, &model, &len, NULL, 0) == 0) {
return len == 9 && strcmp(model, "PowerMac") == 0;
}
#endif
return NO;
}
--
Shaun Wexler
MacFOH
http://www.macfoh.com
"Things should be described as simply as possible, but no simpler." -
Albert Einstein
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden