News for hackers. Stuff that matters.
Re:Swift System Is Now Open Source by jarjoura on Friday September 25, 2020 @05:22PM (#24594240)
C++ doesn't have a stable ABI, so if you target a C++ symbol manually like this, as soon as the compiler revs, to say, C++20, the ABI will change and you'll get a linker error.

Also, this may work for simple C++ methods, but once you cross over into vtable territory, you're going to be in a world of hurt.

Also as far as interoperability, I just don't see a smooth path forward between Swift and C++. Philosophically, much of the C++ code you write ends up compiling away or building specialized generated code at compile time. Anything written in C++17 and newer will also have a lot of constexpr code that generates immutable results baked into the final output.

I'd say, wrap your C++ in a simple C API and expose that to Swift (same would apply to Go/Rust or any other language honestly).

Re:Swift System Is Now Open Source by floatboth on Saturday September 26, 2020 @10:51AM (#24599262)
Hot take: ABI stability is overrated. How often do you need to relink specifically without recompiling everything? As an OS packager, it's no big deal to rebuild everything depending on a C++ shared library when that library is updated. For self-contained binary distributions, statically linking the C++ library or putting the shared objects together works fine still.

vtables are always a pain, but I think the Swift team had some cool ideas about vtables and other dynamic stuff across dynamically linked shared objects..

upd: https://gankra.github.io/blah/swift-abi/ this

Re:Swift System Is Now Open Source by jhatemyjob on Saturday September 26, 2020 @03:08PM (#24601331)
A good build system would solve those problems. Yes a C wrapper is way easier.
Re:Swift System Is Now Open Source by trasz on Saturday September 26, 2020 @08:47AM (#24598400)
Stable C++ ABI depends on implementation, it’s not inherent to the language.