From Free Pascal wiki
Jump to: navigation, search
Logo OSX.png

This article applies to Mac OS X only.

See also: Multiplatform Programming Guide


This package contains Pascal translations of various Mac OS X framework headers.

In FPC 2.4.0 and earlier, these headers are only available for PowerPC and Intel 32 bit. Most headers in these versions are limited to their state in Mac OS X 10.1, although some are newer (a few have even been updated to Mac OS X 10.5).

In later FPC versions, they are also available for 64 bit platforms and for iPhoneOS/ARM, and have been updated to Mac OS X 10.6. Since not all APIs are available to 64 bit and iPhoneOS applications in the C headers, the same is of course true for the Pascal translation. See Apple's documentation for details about which APIs are available on which platforms.

Carbon framework

The Carbon framework is not available at all on the iPhoneOS platform, and is only partially available on 64 bit platforms. Over time, it will however disappear for 64 bit platforms as well, as explained on the carbon-dev mailing list by an Apple engineer.

Therefore, while on 32 bit platforms the MacOSAll unit contains a {$linkframework Carbon} statement so that any program using that unit automatically links in the Carbon framework, we have opted not to do this for 64 bit platforms. On those platforms, the MacOSAll unit will by default only link against the CoreFoundation framework. If you wish to use Carbon functionality from a 64 bit application, you must therefore explicitly link it in by adding the aforementioned statement to your program.

A side-effect of this policy is that the the GetKeys routine is not available in the 64 bit version of MacOSAll. The reason is that this function is implemented using a wrapper, which in turn calls the real GetKeys routine from the Carbon framework. As a result, if smart linking/dead code stripping is not enabled, then the presence of this wrapper in your program (via the MacOSAll unit) makes your program depend on the Carbon framework, which as mentioned above is not very nice for 64 bit programs. Therefore this one function is available in a separate unit called KeyEvents when compiling for 64 bit. For 32 bit programs, this unit also exists, but is empty (simply to avoid requiring ifdefs in case you need this routine in 64 bit).