News for hackers. Stuff that matters.
Re:Closing the gap: cross-language LTO between Rust and C/C++ by zelly on Friday September 20, 2019 @11:22AM (#21027692)
Yes I realized porting a template library to Rust would basically require implementing a whole new compiler (easily more difficult to implement than all of Rust). Like you said, the only workable way is to link to C++ source code (fully translated units/obj files) compiled by clang. Rust would have to learn how to use C++'s name mangling, data alignment, and calling conventions to be able to invoke C++ functions. See my other post in this thread.

Basically it would be a "extern C++". The FFI to C++ would hopefully have as low overhead as "extern C" while making it easier for C++ codebases to gradually adopt Rust.

Re:Closing the gap: cross-language LTO between Rust and C/C++ by pornel on Friday September 20, 2019 @02:54PM (#21030014)
> Rust would have to learn how to use C++'s name mangling, data alignment, and calling conventions to be able to invoke C++ functions.

This is already supported (via Bindgen).

Re:Closing the gap: cross-language LTO between Rust and C/C++ by zelly on Friday September 20, 2019 @03:55PM (#21030575)
Thanks for pointing me to this. Wow. Looks like I can finish learning Rust.