Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview

Buy Now

Issue 5.1


Detecting Rosetta

Are we running under emulation?

Issue: 5.1 (September/October 2006)
Author: Christian Schmitz
Author Bio: Christian Schmitz is the creator of the Monkeybread Software REALbasic Plugins.
Article Description: No description available.
Article Length (in bytes): 7,162
Starting Page Number: 44
Article Number: 5119
Resource File(s):

Download Icon 5119.zip Updated: 2006-09-28 14:14:23

Related Link(s): None

Excerpt of article text...

Recently someone asked about how to detect whether or not the application is running using Rosetta. Rosetta is Apple's name for the PowerPC emulator in Mac OS X which enables Macs with Intel CPUs to run PowerPC applications.

Knowing, from inside your application, whether the CPU is emulated or not is quite useful. You may have platform-dependent code in external libraries and need to load the correct one. Or you may need to use different code depending on whether or not the application is running under emulation.

How to check for Rosetta

There are several ways to detect Rosetta. Most of them query some specific setting from the operation system to check for a certain value. Apple describes a way in their documentation which checks for the presence of a specific key. The approach we take here is to check for a special value in a kernel variable. The kernel variable, labeled "model", contains the model name of the machine. While this variable will be model-specific on an actual PowerPC Mac, under emulation the variable will always be the same. Inside Rosetta we always get the model name "PowerMac" while on a PowerMac G5 the value is "PowerMac8,3", where the eight is for the eighth generation and the three is for the third release. On an iBook G4 the value is, for example, "PowerBook6,7".

...End of Excerpt. Please purchase the magazine to read the full article.