• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Determining how the app is run (intel/ppc/rosetta/os version)?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Re: Determining how the app is run (intel/ppc/rosetta/os version)? (From: Gerben Wierda <email@hidden>)
 >Re: Determining how the app is run (intel/ppc/rosetta/os version)? (From: Greg Hurrell <email@hidden>)
 >Re: Determining how the app is run (intel/ppc/rosetta/os version)? (From: Gerben Wierda <email@hidden>)
 >Re: Determining how the app is run (intel/ppc/rosetta/os version)? (From: Greg Hurrell <email@hidden>)
 >Re: Determining how the app is run (intel/ppc/rosetta/os version)? (From: Gerben Wierda <email@hidden>)
 >Re: Determining how the app is run (intel/ppc/rosetta/os version)? (From: Gerben Wierda <email@hidden>)

  • Prev by Date: Re: Re : Newbie Q : Not-so-simple encoding&decoding example
  • Next by Date: Re: Determining how the app is run (intel/ppc/rosetta/os version)?
  • Previous by thread: Re: Determining how the app is run (intel/ppc/rosetta/os version)?
  • Next by thread: Re: Determining how the app is run (intel/ppc/rosetta/os version)?
  • Index(es):
    • Date
    • Thread