Digging Into the Objective-C Runtime

Digging to China.

image via http://www.flickr.com/photos/martiniglistens/

Greg Parker recently tweeted a link to fantastic site he created, An Illustrated History of objc_msgSend, that provides a trip through history of one of the likely most often called, but unheard of functions in iOS or OS X, objc_msgSend. The function dates back to NeXT and the origins of Mac OS and iOS. It’s interesting to see how it has evolved through the versions of the OS, the transitions between processor architectures, and how priorities in the algorithm have changed as hardware has. It was the underpinning of the Objective-C runtime back on those first PowerPC based Macs and still is today on the latest A7 based iOS devices. Incredible.

If you want to learn more about the Objective-C runtime it’s actually open source and is available from Apple’s open source site at objc4-555.1. To go along with the source Apple provides the Objective-C Runtime Programming Guide and Objective-C Runtime Reference. Definitely read through these and take the time to learn more about how the runtime and your modern Objective-C code are related.

Outside of Apple’s documentation, perhaps the best series of posts on the Objective-C runtime and how you can use it are by Mike Ash. Despite the fact that they date back to 2009 and 2010, they’re still very relevant today.

Finally, if you’re looking to do some hacking on the runtime itself, or experiment with patterns and practices from other languages check out libextobjc by Justin Spahr-Summers, one of the Mac developers at GitHub.

Thanks again to Greg Parker for the retrospective, his time spent hacking away on the runtime, and for the inspiration for this post!

Steven Huey

Steven Huey

Senior Software Engineer at Art & Logic
Mac and iOS developer and project manager at Art+Logic. Twitter | GitHub
Steven Huey

@stevehuey

Father of 4 |  Developer
@CastroSupport I’m seeing 500 and other errors like this in the app today. Are there server issues atm? https://t.co/rLJbd1QVRe - 4 days ago
Steven Huey

Tags:

Creative Commons License

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.