Mac Forums

Mac Forums (http://www.mac-forums.com/forums/)
-   OS X - Development and Darwin (http://www.mac-forums.com/forums/os-x-development-darwin/)
-   -   Carbon or not? (http://www.mac-forums.com/forums/os-x-development-darwin/147753-carbon-not.html)

A_SN 04-05-2009 11:14 AM

Carbon or not?
 
As some of you may know from my other semi-related thread, I'm a Windows developer and I've set out to port my commercial Windows program to Mac OS X. It's entirely written in C, and the overwhelming majority of the code is platform independent, and using a bunch of open source libraries for that (SDL, Allegro, DevIL, libsndfile, libmpg123..). The problem I'm facing is knowing what to replace the few Windows API calls with, and how to deal with the aspects unique to Mac OS X, e.g. the menus.

The Windows API calls consist in pretty simple stuff, such as a function to pop up an Open dialog, same for a Save dialog, a function to detect how many CPU cores we have (that one's probably in POSIX), a function to copy an image to clipboard.. My program being entirely in C, according to what I've recently read, I should aim to replace my WinAPI calls with Carbon API calls, correct? But here's the problem, I've also read that apparently Carbon is already old and being pushed out, that "it is not a good idea to write new applications using Carbon", and that you can't even build 64-bit apps with it.. Doesn't sound any good to start porting to it against all recommendations..

But on the other hand, what other choice is there? Surely a pure C program can't use Cocoa? What else is there? Or is Carbon a decent choice for the little I need?

louishen 04-05-2009 11:37 AM

You might want to post that thread in the Apple developer forums as well

Apple - Support - Discussions - Developer Forums

A_SN 04-05-2009 11:46 AM

Quote:

Originally Posted by louishen (Post 828585)
You might want to post that thread in the Apple developer forums as well

Apple - Support - Discussions - Developer Forums

Oh thanks, just done :)

xstep 04-05-2009 03:19 PM

You'll definitely get great answers from the Apple developer forums.

Sounds like you have some code separation between the underlying C code and your GUI presentation code. Given that, I think you'll find using XCode and Interface Builder a fine solution which is also the long term solution. Apple has effectively announced the death of Carbon.

There is one blog out there by a guy who compares Windows and Cocoa coding & ideas. Unfortunately, for the life of me, I can' remember it. It is something I run a cross via other sites linking to it.

xstep 04-19-2009 02:17 PM

Quote:

Originally Posted by xstep (Post 828637)
There is one blog out there by a guy who compares Windows and Cocoa coding & ideas. Unfortunately, for the life of me, I can' remember it.

Here it is COCOA [The .NET Addict's Blog]. I've linked specifically to the Cocoa tag as there are other things there.

DairyKnight 04-27-2009 11:04 AM

You can mix C with Objective C code. Cocoa is a better choice.


All times are GMT -4. The time now is 11:32 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.