On Tuesday, 5 January 2016 at 21:33:07 UTC, Walter Bright wrote:
On 1/5/2016 10:57 AM, Ola Fosheim Grøstad wrote:
CoreFoundation provides easy bridging with Objective-C/Swift.

CF is an interface to C, not C++, and it uses wrappers and such, not direct APIs. It also has COM-like support - D also supported COM since Day 1.

That isn't remotely good enough to be called an interface to C++.

I think I wasn't clear in what I wrote. CoreFoundation is implemented in C, but CF objects aren't really an interface to C, but memory objects that (may) provide a toll free bridge to NSObject ARC protocols. Thus supports ARC by recasting a pointer rather than wrapping or conversion.

My point was more that in order to interface well with Swift I should generate objects that are toll free castable to ARC objects when I allocate. But I don't want that in my C++ code anyway, so therefore I might as well have a Objective-C++ layer between Swift and C++ on iOS.

I don't want lots of raw C malloc or C++ objects on the Swift side...

As Jacob pointed out, that does not work on Linux, but I am ok with C interfaces to C++ code on Linux.

iOS is different since so many OS calls _requires_ Objective-C function calls, so on iOS you often need to mix Objective-C and C++ (or whatever language you use).


Reply via email to