ADC Home > Reference Library > Technical Q&As > Legacy Documents > Mac OS 9 & Earlier >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

Determining if a 680x0 program is Running on a PPC


Q How do I determine if my 68K program is running on a PPC?

A The best way to do this is to use the Gestalt Selectors as described in the Universal Interface file Gestalt.h:
enum {
    gestaltSysArchitecture = 'sysa',   /* Native System Architecture */
    gestalt68k    = 1,                   /* Motorola MC68k architecture */
    gestaltPowerPC    = 2                /* IBM PowerPC architecture */
};

A snippet of code that uses this could look something like this in your 68K program:

#include <gestalt.h>
#include <stdio.h>
#include <Types.h>

    long myattr;
    OSErr err;

     err = Gestalt( gestaltSysArchitecture, &myattr;);
     if (err == noErr) {
        if (myattr == gestaltPowerPC) {
            InstallExtraPPCComp();
        }
    } else {
        // handle error condition
    }

Updated: 27-September-96


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.