• 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
Re: Integrating C++ into Swift
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Integrating C++ into Swift


  • Subject: Re: Integrating C++ into Swift
  • From: email@hidden
  • Date: Sat, 13 Jun 2015 12:12:12 -1000

There are basically two options.

Expose a C interface to your C++ or use Objective-C++ (this is the easiest option).

Sent from my iPhone

> On 2015/06/13, at 10:03, Rick Mann <email@hidden> wrote:
>
>
>> On Jun 13, 2015, at 12:34 , Uli Kusterer <email@hidden> wrote:
>>
>> Yeah, using ObjC++ right now. Swift does not have any way to talk to C++. Best on I know to do is go via C (e.g. by creating C++ methods declared as 'extern ā€œCā€ā€™) or ObjC (by creating an outwardly ObjC class that is ObjC++ internally).
>
> This is one of the biggest limitations in migrating our code. We have a lot of C++, and it's not going away. Seems to me Swift could have supported at least calling out to C++. Eh, I guess that's asking too much.
>
> Best bet is to tediously create the C shim with a bunch of functions, one for each method you need to call, passing "this" as the first parameter, and translating between Swift and C++ data structures where needed. Might introduce some real overhead (e.g., convert a std::vector to []).
>
> --
> Rick Mann
> email@hidden
>
>
>
> _______________________________________________
>
> 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

_______________________________________________

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


References: 
 >Integrating C++ into Swift (From: Uli Kusterer <email@hidden>)
 >Re: Integrating C++ into Swift (From: Quincey Morris <email@hidden>)
 >Re: Integrating C++ into Swift (From: Uli Kusterer <email@hidden>)
 >Re: Integrating C++ into Swift (From: Rick Mann <email@hidden>)

  • Prev by Date: Re: Language options: Objective-C, Swift, C or C++?
  • Next by Date: Re: Language options: Objective-C, Swift, C or C++?
  • Previous by thread: Re: Integrating C++ into Swift
  • Next by thread: Buy music on iTunes
  • Index(es):
    • Date
    • Thread