4 ms·
I wonder how this compares to Mozilla's approach when they did something similar with Rust, Firefox and servo.
by brian_herman__ 6y ago
I wonder how this compares to Mozilla's approach when they did something similar with Rust, Firefox and servo.
- muizelaar 6y agoMozilla's uses a combination of https://github.com/eqrion/cbindgen https://github.com/eqrion/cbindgen and https://github.com/rust-lang/rust-bindgen https://github.com/rust-lang/rust-bindgen depending on the direction of interop. These tools don't provide the safety guarantees of https://github.com/dtolnay/cxx https://github.com/dtolnay/cxx but the also both predate cxx and C++ doesn't have much in terms of safety guarantees to begin with so the bar is pretty low.
- jcranmer 6y agoIt's also worth mentioning that Mozilla tends not to use a lot of standard C++ types, using nsTArray instead of std::vector or nsA?C?String instead of std::string. This makes the porting of APIs using arrays or structs easier, since Mozilla owns the ABI rather than needing to worry about different standard libraries having different ABIs.
- ChrisSD 6y agoC++ interop with C++ can be a pain. E.g. even with the same version of the same compiler, GCC can have different options enabled that affect the layout of some types.
- ncmncm 6y agoThat is the same in all languages mature enough to have variant options. Rust included. Therefore, a tendentious distraction from the topic. Chris, I shall expect better from you in the future.
- fgdfgddfg 6y agoLooks like the Chromium team could also snag a few of them, since servo team is axed https://twitter.com/ddprrt/status/1293570734271406080 https://twitter.com/ddprrt/status/1293570734271406080