4 ms·
> I don't believe LLVM provides a stable cross language ABI, and AFAIK languages just use regular FFI (via the C ABI) to communicate with one another Provided
by ihnorton 8y ago
> I don't believe LLVM provides a stable cross language ABI, and AFAIK languages just use regular FFI (via the C ABI) to communicate with one another
Provided the compilers generate compatible versions of LLVM IR, then cross-language calls can be done at the IR level. See github.com/Keno/Cxx.jl
IIUC Swift already uses clang to load module maps in order to expose and call Objective-C, and they plan to do something similar with C++ (no link handy but I think there is an issue or enhancement proposal about it).
- slavapestov 8y agoYeah, Swift’s C interop goes further than most typical FFIs because it actually calls into Clang internals to read headers, lay out structs and form calls. C and Objective-C types, functions and methods are mapped to Swift definitions, by directly looking at the Clang AST.