Re: Integrating C++ into Swift
Re: Integrating C++ into Swift
- Subject: Re: Integrating C++ into Swift
- From: Rick Mann <email@hidden>
- Date: Sat, 13 Jun 2015 13:03:30 -0700
> 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