Carbon Basics

This chapter describes the basics of Carbon, how it fits into Mac OS X, and the tools you use to build Carbon applications.

What's in Carbon?

Carbon contains thousands of functions, data structures, and constants. Related functions and data structures are organized into functional groups, usually referred to as managers or services. For example, the Window Manager contains functions and data structures that let you create, remove, and otherwise manipulate application windows.

As a general rule, Carbon interfaces are those that are part of the Carbon umbrella framework; that is, those that are included when you include the Carbon.h header.

This document also describes a number of managers or services that you can call from a Carbon application (for example, Quartz and QuickTime). Some of these technologies use Objective-C, which may require you to write some wrapper code.

Carbon and Mac OS X

As shown in the following figure, Carbon is one of several application environments available on Mac OS X.

Illustrates the programming layers on Mac OS X, from the kernel environment at the bottom to the application frameworks at the top.

These other environments include:

These environments depend on the same application and core services for their operation, and the underlying services rely on Darwin (Apple's open-source core operating system) and the Mach kernel.

Each environment (including the optional BSD command-line environment) has advantages and disadvantages, but for C and C++ programmers, Carbon is the best choice.

Building Carbon Applications

Xcode and Interface Builder are Apple's development tools for building Mach-O-based applications on Mac OS X. Both tools support Carbon, and they come free with Mac OS X, making them excellent choices for new developers targeting Mac OS X. Also Xcode is currently the only development environment that allows compiling for both PowerPC and Intel-based Macintosh computers.

Xcode and Interface Builder work in conjunction with each other to make building applications easier than ever:

Xcode uses open-source developer tools (such as the GCC compiler) under the hood. If you are comfortable doing so, you can run these tools yourself from the command line using the Terminal application, writing Make files and so on.