O'Reilly logo

Advanced Mac OS X Programming: The Big Nerd Ranch Guide by Mark Dalrymple

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Objective-C

Objective-C is the language used to program the Cocoa toolkit. It is a thin layer on top of C with a little additional syntax, a runtime component, and a big pile of metadata to support the dynamic nature of the language. But fundamentally, Objective-C is still C. Many programmers forget Objective-C’s C heritage and fail to take advantage of C’s language features and libraries.

C callbacks in Objective-C

A question that comes up fairly frequently in online forums is, How do I put a method into a function pointer? Nine times out of ten, the poster actually wants to use Cocoa with an existing C API that uses callbacks. A much better question is, I’m using a C API that uses callbacks with Cocoa, how do I make it work?

Even though ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required