John Lam 1997 — 2026

Who's the Jeffrey Richter of the Mac OS X world?

As my anticipation is building for the newest member of my (computer) family, I have a bunch of questions that I would love to have answered by an “Advanced Windows” style of book, but for Mac OS X. As a long-time Windows dev, I have a lot of questions to ask about OS X:

  • How is code packaged for execution and sharing (i.e. what are the equivalents of EXE’s and DLL’s in OS X)

  • Is OS X a shell on top of Free BSD? In other words, I’m assuming that it is the Unix definitions of processes and threads that I should be reading about?

  • While looking at some Emacs distributions for OS X, I noticed that there isn’t binary compatibility between OS 10.1 and OS 10.2. Why did the executable file format change? Is there an equivalent of Portable Executable files in that world?

  • Should I learn Cocoa? Or are there other ways of programming the Aqua UI?

  • How do I interoperate between code written using Objective-C and classic C/C++?

So many questions and so few books. My local bookstore has very few books on Mac OS X programming. I’m hoping that the resources on Apple’s Developer Connection web site will help jump start my experience.

12 archived reader comments

Gordon Weakliem (2002-12-17)

A couple blogs to start with at least: James Duncan Davidson http://www.x180.net/Blog Brian Jepson: http://www.jepstone.net/radio/

John Lam (2002-12-17)

Thanks Gordon! I’ve added them to my blogroll.

Steve Makofsky (2002-12-17)

When I got the Mac a month ago, I was recommended to get: Cocca Programming for Mac OSX Havent done much yet, but, it’s a good book. The best reading material that i’ve found so far are by Apple: http://developer.apple.com/techpubs/macosx/Essentials/devessentials.html The system overview, and aqua human interface guidelines are definately a must.

Sam Gentile (2002-12-18)

Brian has a great O’Reilly book “Mac OS/X for Unix Geeks.” I used the Cocca Programming for Mac OS/X on a contract a while ago.

John Lam (2002-12-18)

Hey thanks guys! I’m going to check out the Mac OS/X for Unix Geeks book today. I’m slowly going through “The Developer Essentials” guide at Apple as well. At least now I’m getting a better idea about how the various layers get put together. I also found out the answer to one of my questions: Unix wasn’t designed to be binary compatible from release-to-release, and the OS 10.1 to 10.2 upgrade changed the underlying version of Darwin. I guess that’s just one of the things that I’m going to have to get used to in the OS X / Unix world.

Dave Lee (2002-12-18)

I think the binary changes between 10.1 and 10.2 could be due to the GCC C++ ABI changes. 10.2 uses a pre-3.2 gcc, and gcc-3.2 is supposed add adherence to some C++ ABI standard of which other vendors also follow. I don’t know if the jaguar gcc version, being a cvs snapshot taken before 3.2 was released, generates binary compatible code with gcc-3.2, if so then hopefully future releases will not cause backward incompatibility, if not, then the next OS X release will likely be binary compatible again. Just write some Cocoa Java Though, I don’t even know how much C++ code actually exists in OS X.

Chris Gervais (2002-12-18)

1) How is code packaged for execution and sharing (i.e. what are the equivalents of EXE’s and DLL’s in OS X) Mac OS X applications are actually a directory with a .app extension that the Finder and UI interpret as an application. Sharing code, ala DLLs, can be accomplished in a number of ways: one is to use the CFBundle framework to package the code as a bundle and load and call it dynamically. The other is to use the CFPlugIn APIs which are somewhat COM-compatible. You can also create low-level dynamic librarys, dylibs. 2) Is OS X a shell on top of Free BSD? In other words, I’m assuming that it is the Unix definitions of processes and threads that I should be reading about? You should start by reading up on the Mach kernel which will give you an idea of processes and how threads work. There are a few different threading models available on Mac OS X (Carbon cooperative threads, pthreads, etc.). 3) While looking at some Emacs distributions for OS X, I noticed that there isn’t binary compatibility between OS 10.1 and OS 10.2. Why did the executable file format change? Is there an equivalent of Portable Executable files in that world? Not true…you can compile an app on Mac OS X 10.1 and it will run just fine on Mac OS X 10.2. Apple upgraded the gcc for 10.2 which doesn’t produce backwards compatible ABI layout for 10.1. 4) Should I learn Cocoa? Or are there other ways of programming the Aqua UI? Learn Cocoa. Learn Objective-C. You’ll love it. I waited too long before diving into Objective-C cuz I was a fraidy cat and the square brackets looked intimidating. The programming is great and Cocoa frameworks are to die for. That said, you can create UIs in Interface Builder and code in Carbon or Cocoa-Java. Or, you can go 100% pure Java and use AWT and Swing. 5) How do I interoperate between code written using Objective-C and classic C/C++ Objective-C is C so you can mix the two to your heart’s content — I do it all the time. I call Carbon functions from Cocoa and you can even use Objective-C++ and get wicked cool integration between your C++ objects and Objective-C objects. Until you really start using the Mac OS X development environments, and figure out all of the options, its coolness is only something you read about!

John Lam (2002-12-18)

Thanks for the great answers, Chris! I’m sure I’ll have more questions

Chris Gervais (2002-12-19)

I’m more than happy to help with any questions in any way that I can — just e-mail me! Sorry that my post showed up twice — when my TiBook woke up I was still on the comment posting page and hit refresh by accident.

Sam Gentile (2002-12-19)

So John, it looks line you are going to be doing more C++ after all-)

Sam Gentile (2002-12-19)

BTW, John, can you as the AOP guy take a look at this: http://radio.weblogs.com/0105852/2002/12/19.html#a1623

Gordon Weakliem (2003-01-02)

I also ran into an interesting item at the bookstore the other day: Cocoa Recipies for Mac OSX, which has an associated website[1] [1] http://www.stepwise.com/Articles/VermontRecipes/index.html