Re: Determining how the app is run (intel/ppc/rosetta/os version)?
Re: Determining how the app is run (intel/ppc/rosetta/os version)?
- Subject: Re: Determining how the app is run (intel/ppc/rosetta/os version)?
- From: Dirk Stegemann <email@hidden>
- Date: Fri, 26 May 2006 17:57:37 +0200
Dag Gerben,
Am 26.05.2006 um 14:42 schrieb Gerben Wierda:
So I started looking for ways to determine the way the app is run.
I tried doing some stuff through sysctl, but failed. Below is an
example. The CTL_KERN/KERN_VERSION works, but CTL_HW/HW_MACHINE_ARG
does not.
Is OS X broken here or am I doing something boneheaded?
This code was derived from an Apple engineer's example and works fine
inside a dynamically loaded UB bundle, returning true incase it was
loaded by a PPC application which runs translated by Rosetta:
-----snip-----
#if __BIG_ENDIAN__ && TARGET_API_MAC_OSX
#include <sys/types.h>
#include <sys/sysctl.h>
bool Is_DLL_emulated()
{
static bool didCheckForRosettaEmulation = false;
static bool isDLLEmulated = false;
int ret = 0;
size_t sz = sizeof(ret);
if (!didCheckForRosettaEmulation) {
if (sysctlbyname("sysctl.proc_native", &ret, &sz, NULL, 0)
== -1) {
isDLLEmulated = false;
} else {
isDLLEmulated = (ret != 1);
}
didCheckForRosettaEmulation = true;
}
return isDLLEmulated;
}
#else
static bool Is_DLL_emulated()
{
return false;
}
#endif // __BIG_ENDIAN__ && TARGET_API_MAC_OSX
-----snip-----
Best regards,
Dirk Stegemann
_______________________________________________
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