Carbon Core Deprecations

Carbon Core, a subframework of the Core Services umbrella framework, contains the programming interfaces of many legacy Carbon managers, in addition to various utilities. In OS X v10.8, most of these interfaces are deprecated.

If your app uses APIs in the Carbon Core framework, it’s recommended that you investigate ways to update your code. This document lists the Carbon Core header files that are deprecated in OS X v10.8 and summarizes some of the alternative APIs you can use.

Contents:

AIFF

The AIFF header file defines the AIFF file format. Beginning in OS X v10.8, AIFF.h will no longer be updated or maintained.

Aliases

The Aliases header file defines the functions of the Alias Manager, which was designed to help you create and resolve alias records (alias records are data structures that describe file system objects, such as files, directories, and volumes). To access the same type of information in your OS X v10.8 app, you should use the bookmark APIs provided by the NSURL and CFURL classes instead.

A bookmark is an opaque data structure that describes the location of a file. Although path and file reference URLs can be fragile between launches of your app, a bookmark can usually be used to re-create a URL to a file even when the file has been moved or renamed. If you have an alias file that contains Alias Manager information, use bookmarkDataWithContentsOfURL:error: to synthesize bookmark data for the file. To learn more about using bookmarks, see NSURL Class Reference and CFURL Reference.

Collections

The Collections header file defines the functions of the Collection Manager, which was deprecated prior to OS X v10.8. The Collection Manager defined an abstract data type that allowed you to store a collection of information. To manage collections of objects in your app, use the collection APIs in Foundation or Core Foundation (for more information, see Collections Programming Topics and Collections Programming Topics for Core Foundation).

Components

The Components header file defines the functions of the Component Manager, which was designed to help you find and use components in your app or add custom components to system-provided services, such as QuickTime and Core Audio. The Component Manager is deprecated in OS X v10.8, and there is no exact replacement for it. If you use QuickTime in your app, you might need to continue using the Component Manager to browse the built-in QuickTime components or add custom components.

If you use the Component Manager to define custom components that extend your app, consider creating a custom a plug-in model to replicate the functionality you need (to start learning about plug-ins, see Plug-in Programming Topics). If you need to find and open audio units and audio codecs in your app, use Audio Component Services instead of the Component Manager (for more information, see Audio Component Services Reference).

ConditionalMacros

In OS X v10.8, the contents of the ConditionalMacros header file have been moved to /usr/include/ConditionalMacros.h.

Debugging

The Debugging header file defines macros that handle assertions and exceptions. In OS X v10.8, these macros are available in /usr/include/AssertMacros.h.

DriverServices

The DriverServices header file defines functions that help you manipulate time-based data. To perform these functions in your OS X v10.8 app, use the CFAbsoluteTime or Mach time APIs instead. For a summary of timer objects in Mach, see Time Management; to learn more about mach_absolute_time, see Mach Absolute Time Units.

DriverSynchronization

The DriverSynchronization header file defines functions that perform operations—such as compare and swap—in an atomic or synchronized manner. To get this functionality in your code, use the Mach OSAtomic APIs instead (to learn more about the OSAtomic APIs, see libkern Reference).

Endian

The Endian header file defines the Core Endian API, which provides functions that help you convert data between big-endian and little-endian formats. To replace this functionality in your code, use the Core Foundation byte order functions (described in Byte-Order Utilities Reference) instead.

Files

The Files header file defines the File Manager API, which is deprecated in OS X v10.8. The File Manager provides functions that operate on files, folders, and volumes without exposing low-level implementation details, such as file system and volume formats.

There are many Foundation, Core Foundation, Disk Arbitration, and POSIX and BSD APIs you can use to replace the File Manager functions in your app. For example, if you need to get notifications when a folder changes, use the File System Events API (to learn more about this API, see File System Events Programming Guide). Or if you need to mount, unmount, or eject a local volume, use the Disk Arbitration API (to learn more about the Disk Arbitration API, see Disk Arbitration Programming Guide).

To find out which APIs are recommended to replace specific File Manager functions, see File Manager Reference.

Finder

The Finder header file defines data types and constants that help you use Finder metadata to access file system items. Although you should not directly manipulate Finder information, you can access the information by using properties of CFURL and NSURL objects, such as kCFURLIsAliasFileKey, kCFURLIsHiddenKey, and kCFURLHasHiddenExtensionKey. In addition, you can use the Launch Services API to register the document types that your app supports (to learn about using Launch Services in your code, see Launch Services Programming Guide).

FixMath

The FixMath header file defines functions that convert between numbers represented in different formats (such as fixed-point decimal and floating point) and functions that perform calculations. In OS X v10.8, the use of fixed data types is deprecated; use standard C floating point types instead.

Folders

The Folders header file defines the functions of the Folder Manager, which was deprecated prior to OS X v10.8. The Folder Manager defined functions that allowed you to find and create folders and control how files are routed between folders. In OS X v10.8 and later, use the NSPathUtilities API instead (for more information, see NSString Class Reference, NSArray Class Reference, and Foundation Framework Reference).

fp

The fp header file defines trigonometric, hyperbolic, and other functions that help you perform numerical calculations. To perform these calculations in an app running in OS X v10.8 and later, use the API defined in /usr/include/math.h instead.

Gestalt

The Gestalt header file defines the functions of the Gestalt Manager, which allows you to investigate the operating environment of your app. If you need to get system information in an app running in OS X v10.8 or later, use sysctl instead.

HFSVolumes

In OS X v10.8, the HFSVolumes header file contains only the definition of the HFSCatalogNodeID type, which is used to identify a file or folder in an HFS Plus file system. OS X does not supply programming interfaces defining the on-disk data structures that HFS uses.

LowMem

The LowMem header file defines functions enabling access to types of data that were stored in low-memory variables in versions of Mac OS prior to OS X. In earlier versions of OS X, these functions were supported to facilitate the porting of legacy apps. No modern OS X app should use these functions to get information about a service or the system. If, for example, you need to get the position of the mouse pointer, you would use a higher-level API such as Quartz Display Services (to learn about the Quartz Display Services, see Quartz Display Services Programming Topics).

MacErrors

The MacErrors header file defines error codes that were used in many legacy APIs. As much as possible, migrate to APIs that return NSError (or CFError) objects instead. To learn more about using NSError and CFError objects, see NSError Class Reference and CFError Reference.

MachineExceptions

The MachineExceptions header file defines data structures that represent the architecture of various CPUs and exception-handler functions. In general, use Mach functions to get this information instead.

MacMemory

The MacMemory header file defines many of the functions of the Memory Manager, which is available only for compatibility with legacy apps and API. Among other things, the Memory Manager helped developers set up an app’s memory partition at launch time and helped perform memory-management tasks that became unnecessary in OS X. Except for QuickTime usages, you can use other API instead of Memory Manager API. For example, if you use NewHandle or NewPtr for simple allocations, use malloc instead. If you use handles to contain resizable or editable data, switch to the CFMutableData API (for more information, see CFMutableData Reference). Finally, use memmove instead of BlockMove or BlockMoveData, and use bzero or memset instead of BlockZero.

MacTypes

The MacTypes header file defines basic data types, such as UInt64 and Boolean. If you need to include this header file for compatibility with legacy code, use /usr/include/MacTypes.h instead.

Math64

The Math64 header file defines functions that perform 64-bit integer calculations. Because current compilers support 64-bit integer math by default, you should no longer use the functions in Math64.h.

MixedMode

The MixedMode header file defines the functions of the Mixed Mode Manager, which is available only for compatibility with legacy apps. The Mixed Mode Manager provided an API to handle switching between the PowerPC and 68K architectures. In OS X v10.8, this API is obsolete.

Multiprocessing

The Multiprocessing header file is part of the legacy Multiprocessing Services API, which allowed legacy apps to support multitasking. In OS X apps, you should support multitasking by using Grand Central Dispatch or POSIX threads. To learn about multiprocessing on OS X, see Concurrency Programming Guide; to learn about POSIX thread routines, see pthread(3) OS X Developer Tools Manual Page. You can find out about timer objects in Mach in Time Management; to learn more about mach_absolute_time, see Mach Absolute Time Units.

MultiprocessingInfo

The MultiprocessingInfo header file is part of the legacy Multiprocessing Services API. In OS X apps, you should support multitasking by using blocks or Grand Central Dispatch. To learn about multiprocessing on OS X, see Concurrency Programming Guide.

OSUtils

The OSUtils header file defines the functions of the Memory Management Utilities API, which is available only for compatibility with legacy apps. Memory Management Utilities supported functionality such as OS queue management and getting the user or computer name. Here are the alternative APIs you should use instead of the functions deprecated in OS X v10.8:

Deprecated function

Recommended alternative

Delay

sleep, usleep, or nanosleep

Enqueue and Dequeue

queue(3) (use mutex locking)

CSCopyUserName

Use password database operations, such as getpwuid_r, or membership functions, such as mbr_uid_to_uuid

CSCopyMachineName

SCDynamicStoreCopyComputerName

PEFBinaryFormat

The native executable format of OS X is Mach-O, so the preferred executable format defined in PEFBinaryFormat.h is obsolete.

PLStringFuncs

The PLStringFuncs header file defines Pascal string-manipulation routines. In OS X v10.8 and later, use Core Foundation string functions instead (for more information, see CFString Reference).

Resources

The Resources header file defines many of the functions of the Resource Manager, which allows a legacy app to create and manage its resources. In OS X v10.8, the Resource Manager is deprecated. To manage your app’s resources, use bundles instead. You can learn more about bundles by reading Bundle Programming Guide.

Threads

The Threads header file defines the functions of the Thread Manager, which was deprecated prior to OS X v10.8. The Thread Manager supported the cooperative scheduling of threads in an app. In OS X, you should use Grand Central Dispatch (GCD) or POSIX threads instead. To learn more about GCD, see Grand Central Dispatch (GCD) Reference; to learn how to take advantage of threading in your app, see Threading Programming Guide.

Timer

The Timer header file defines the functions of the Time Manager, which was deprecated prior to OS X v10.8. The Time Manager allowed apps to schedule tasks to execute at a later time. To perform similar scheduling tasks in your OS X app, you can use a run loop, an NSTimer object, or one of the POSIX sleep functions (that is, sleep, usleep, or nanosleep). To learn more about Core Foundation run loops, see CFRunLoop Reference; to learn more about the NSTimer object, see NSTimer Class Reference. In addition, Grand Central Dispatch provides a set of dispatch sources which allow you to monitor the activities of low-level system objects (such as Mach ports or Unix descriptors) and submit an event handler to a dispatch queue when a specific activity occurs. To learn more about dispatch sources, see Dispatch Sources.

If you need to know the elapsed duration since the system started up (which is a quantity provided by the deprecated Microseconds function), use mach_absolute_time instead.

ToolUtils

The ToolUtils header file defines bitwise functions, such as BitXor and BitShift. If you need this functionality in your OS X v10.8 app, use the C bitwise operators (such as ^ and >>) instead.