Introduction

[next] [tail] [up]

### 11.1 Introduction

The preferred programming language to access Mac OS X system frameworks is Objective-C. In order to fully realize the potential offered by system interfaces written in that language, a variant of Object Pascal exists in the Free Pascal compiler that tries to offer the same functionality as Objective-C. This variant is called Objective-Pascal.

The compiler has mode switches to enable the use of these Objective-C-related constructs. There are two kinds of Objective-C language features, discerned by a version number: Objective-C 1.0 and Objective-C 2.0.

The Objective-C 1.0 language features can be enabled by adding a modeswitch to the source file:

{$modeswitch objectivec1}

or by using the -Mobjectivec1 command line switch of the compiler.

The Objective-C 2.0 language features can be enabled using a similar modewitch:

{$modeswitch objectivec2}

or the command-line option -Mobjectivec2.

The Objective-C 2.0 language features are a superset of the Objective-C 1.0 language features, and therefore the latter switch automatically implies the former. Programs using Objective-C 2.0 language features will only work on Mac OS X 10.5 and later.

The fact that objective-C features are enabled using mode switches rather than actual syntax modes, means they can be used in combination with every general syntax mode (fpc, objfpc, tp, delphi, macpas). Note that a {$Mode } directive switch will reset the mode switches, so the {$modeswitch } statement should be located after it.

[next] [front] [up]