3 ms·
When interoperating between languages, there are several things to consider: - API - ABI, including threading, exception, function call, and memory models at
by humanrebar 6y ago
When interoperating between languages, there are several things to consider:
- API
- ABI, including threading, exception, function call, and memory models at the ABI level
- build specification
- packaging
This article mostly focuses on API, there seem to be some nods to the other three, but those seem like the harder and more pernicious problems to me.
For instance, how would the build system know that a library is being included that requires the swift runtime? Or even the C++ runtime. If any library was built against a different set of standard library interfaces (of any language), do any tools fail with a useful diagnostic?
That's not to say this isn't helpful research, but there's a lot of work to do before all of this is robust enough to be straightforward for end users.
- oscargrouch 6y agoThis is only being talked about now, because ABI compability is already working. The Swift compiler is in C++ targeting the LLVM and therefore with great interoperability with C and C++ through Clang. The Swift compiler also ships with Clang, and you can link C and C++ projects that are dependencies of Swift packages using the Swift package manager with little effort.
- humanrebar 6y agoIf only having tools from the same toolchain guaranteed ABI compatibility worked! Something as apparently benign as using absl::string_view with different '-std=c++NN' flags in different otherwise unrelated C++ libraries is an ABI break.