• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Help Mixing Objective-C & Objective-C++
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help Mixing Objective-C & Objective-C++


  • Subject: Help Mixing Objective-C & Objective-C++
  • From: James Bucanek <email@hidden>
  • Date: Wed, 23 Feb 2011 11:47:23 -0700

Greetings,

I searched the list, and Apple's documentation, and couldn't find an answer to this (simple) question.

I have a couple of large Cocoa projects that suddenly need to use some C++ libraries (3D graphics stuff). I assume that I can simply start creating Objective-C++ classes to contain this code, but I'm wondering how to cleanly integrate the new Objective-C++ classes with the existing Objective-C classes. Naturally, I need to send messages from my Objective-C classes to my Objective-C++ classes, and vice versa.

Specifically, I create an Objective-C++ class that contain C++ object references and types in its @interface declaration. How can I #import this into an Objective-C module? The Objective-C won't understand any of the C++ class names or types.

Conversely, when #importing Objective-C interfaces in an Objective-C++ module, do I extern "C" { ... } the whole thing?

This is funny, really, because many decades ago I ate, breathed, and slept C++. After discovering Java and ultimately Objective-C, I stood up and--like a scene from Gone With the Wind--declared that I will never write another line of C++ as long as I live! Oh, well. The good news is that C++ doesn't seemed to have changed much...

--
James Bucanek

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Help Mixing Objective-C & Objective-C++
      • From: Uli Kusterer <email@hidden>
    • Re: Help Mixing Objective-C & Objective-C++
      • From: Lee Ann Rucker <email@hidden>
    • Re: Help Mixing Objective-C & Objective-C++
      • From: Kyle Sluder <email@hidden>
    • Re: Help Mixing Objective-C & Objective-C++
      • From: Sean McBride <email@hidden>
  • Prev by Date: Re: Looking for help scanning entire drives
  • Next by Date: Re: Help Mixing Objective-C & Objective-C++
  • Previous by thread: Re: System Configuration Framework And CurrentSet notifications
  • Next by thread: Re: Help Mixing Objective-C & Objective-C++
  • Index(es):
    • Date
    • Thread