5 ms·
> That's what makes Carbon different from any other language: D, Zig, Nim, Rust etc. I know you can compile C++ files to object files, pass them to the D compi
by eric-p7 1y ago
> That's what makes Carbon different from any other language: D, Zig, Nim, Rust etc.
I know you can compile C++ files to object files, pass them to the D compiler, and have them call eachothers' functions. I've never tried it though.
--------
g++ -c foo.cpp
dmd bar.d foo.o -L-lstdc++
--------
https://dlang.org/spec/cpp_interface.html https://dlang.org/spec/cpp_interface.html
- sfpotter 1y agoIt's a great feature, and D has a bunch of support for this kind of thing. But D and C++ have just enough differences to make extern(C++) not be automatic. It can take some pretty arcane metaprogramming to get things to work, and some things are impossible. It's also worth pointing out that D isn't trying to be fully compatible with C++.