19. The Objective-C Runtime

As I said at the start of this book, an Objective-C implementation consists of two parts: the compiler and the runtime library. The compiler takes source code and turns the dynamic bits into calls to the runtime library.

The runtime library is written in C, which means that it is written in a subset of Objective-C. All of the interfaces to the runtime library, including the ones that are called by code generated by the compiler, are accessible to Objective-C code.

Everything dynamic in Objective-C is implemented by the runtime library. The most obvious example of this is message sending. When you send a message, the runtime is responsible for deciding what should handle it.

This is not the only responsibility of the ...

Get Objective-C Phrase Book, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.