Mixing Cocoa & Carbon



Does anyone here have experience of mixing Cocoa and Carbon in one application? Is it at all possible to do?

Basically I wan't to write a program with a part that I want to be able to run in both OS 9, and OS X. But half of the program will be OS X only. I would prefer to write as much as possible in Cocoa.

All ideas and thoughts would be very helpful.
You can call Carbon from Cocoa, but I don't think what you want is possible. Cocoa apps are Mach-O binaries, and Carbon apps that can run on 9 have to be CFM.
Well, maybe I was a little bit unclear. I don't want it all to be one single application. But the 'light' OS 9 version will be a part of the OS X app as well. So if I can call Carbon from Cocoa, open a few Carbon windows etc, I will be fine.

What if you were to use a Plug-In architecture style with pretty much straight C/C++ code. The shells for the applications would only be built using Cocoa or Carbon depending on which version.