Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

AFAIK there's no plan to support any sort of C++ interop natively in Rust. However, it should work just fine if your C++ code exposes a C-compatible interface. Servo has to be able to call into SpiderMonkey somehow.


GCC C++ ABIs are unstable enough that cross-platform C++ libraries usually export a C-compatible interface already.


g++ vs itself, or g++ vs msvc? g++ uses Itanium C++ ABI on at least linux/mac/mingw, and the mangling and vtable layouts seem to be the same (I'm very interested in any information to the contrary - though I realize vtables are only part of the story).


Itanic may be an exception, but there have been at least two backwards-incompatible C++ ABI changes in G++ over the years. Casting to superclass in the presence of multiple inheritance and exception handling have been among the changes. Maybe they should change vtables too, I don't know.


Figured as much - it would be hard to take any language seriously without C interop. But that's a long way from "C++ binary compatibility." I've heard this several times, so I was hoping it might be true.


I've just learned that one of the Samsungers working on Rust has tentative plans to implement C++ interop in the same fashion as D.

http://www.reddit.com/r/rust/comments/1c3clf/c_ffi/c9codm1

In any case, I'm not sure that any official Rust source has ever tried to claim "C++ binary compatibility". Perhaps this language is a result of people misinterpreting the fact that Rust lays out structs in memory in the same fashion as C and C++.


Cool, thanks. I had not seen anything official either - just pipe-dreaming that one of those commenters I saw knew something special.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: