Blog
Mac Development
Date: 31/8/2005
So I swap all the usb cables across to the Mini, power cycle the cable modem, plug in the firewire drive, shutdown that noisy old PC and just sit there in the silence stairing at XCode. Now what?

I originally thought that I'd copy the Linux port into a new directory, rename it "Mac" and then get it compiling against the MacOS X X11 SDK. But when I actually tried that I realised that a) all the Xft and XRender extensions that I use aren't there and b) I know I'm going to throw away all that code and write a cocoa port anyway. So I stopped doing that, and resigned myself to working cocoa out.

Um. So um, how do you connect a C++ API to cocoa again? It seems there is several ways hinted at in various webpages:
  • Use the (MIA) cocoa C bindings.
  • Write in Objective-C++. (How?)
  • Write some glue in Objective-C between the C++ and cocoa.
None of these options are documented anywhere I can find. So I'm really just stabbing in the dark at the moment.

I have a body of C++ code that defines the Lgi API and I want to connect that to cocoa somehow. Ideally I'd like to be able to just call cocoa stuff from within my C++ files, which is what it seems Objective-C++ might be. So on one side I could have a C++ API and the implementation of that C++ calls cocoa. Does anyone know how to do that?

Maybe however you can't do that, and somehow you have to link the C++ against some glue code in a different language. Like maybe Objective-C or C++. Can obj-c/c++ export an API that C++ can call? Probably not... but I thought I'd ask.

This mythical "C API for Cocoa" only gets hinted at in various webpages. Anyone know where to get some docs or headers for that?
Comments:
SnappyCrunch
01/09/2005 11:59pm
I don't know where you can get a C API... I just wanted you to know that I enjoy all the posts yout make, even though you don't get responses to a lot of them.
Bardo
03/09/2005 10:52am
I agree with Snappy :-) Most of the post is just 'a little' over my head. But then again, one is never too old to learn, so that's why I read them.
And yesterday I upgraded my MiniMac to Tiger, so I'm looking forward to the first test-alpha-0.0001rc-build of Scribe for the Mac!
Simon
05/09/2005 7:34pm
I've done lots of work with Objective-C, but none with Objective C++ (C++, shudder!) but I thought you could basically mix OC++ and OC much like you can with normal C++ and C. Have a look on developer.apple.com. A quick search yielded this article:

http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/LanguageOverview/chapter_3_section_10.html

Simon
05/09/2005 9:50pm
I've done lots of work with Objective-C, but none with Objective C++ (C++, shudder!) but I thought you could basically mix OC++ and OC much like you can with normal C++ and C. Have a look on developer.apple.com. A quick search yielded this article:

http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/LanguageOverview/chapter_3_section_10.html

 
Reply
From:
Email (optional): (Will be HTML encoded to evade harvesting)
Message:
 
Remember username and/or email in a cookie.
Notify me of new posts in this thread via email.
BBcode:
[q]text[/q]
[url=link]description[/url]
[img]url_to_image[/img]
[pre]some_code[/pre]
[b]bold_text[/b]