Gestalt Manager

Overview

The Gestalt Manager and other system software facilities allows you to investigate the operating environment. You need to know about the operating environment if your application takes advantage of hardware or software that is not available on all Macintosh computers. You can also use the Gestalt Manager to inform the operating system that your software is present and to find out about other software registered with the Gestalt Manager.

Carbon supports the Gestalt Manager. However, the results returned by Gestalt functions in macOS are relevant only to your application's context. In general, the Gestalt function returns a different result when called from a Carbon application running in macOS than it returns when called from a Classic application in macOS, because these are different environments. For example, Carbon does not use a ROM, so calling Gestalt from a Carbon application on a beige G3 Macintosh computer and passing the ROMVersion selector returns a different result than Gestalt returns for a Classic application on the same computer. In fact, Gestalt could conceivably return different results for the same call by two Carbon applications.

Because Gestalt operates on a per-context basis in macOS, you can't use it to share information (through pointers or any other means) among applications.

The ROMVersion and machineType selectors are not supported in Carbon.

In versions of the Mac OS prior to macOS, the NewGestalt and ReplaceGestalt functions make use of the system heap, so that new or replaced selectors are available to any process. In macOS, however, there is no system heap, and the selectors are available only on a per-context basis.

Symbols

Result Codes

The most common result codes returned by the Gestalt Manager are listed below.

var gestaltUnknownErr: Int

Specifies an unknown error.

var gestaltUndefSelectorErr: Int

Specifies an undefined selector was passed to the Gestalt Manager.

var gestaltDupSelectorErr: Int

Specifies you tried to add an entry that already existed.

var gestaltLocationErr: Int

Specifies the gestalt function ptr was not in the system heap.