Interfacing with Rust
Matheus Catarino
matheus-catarino at hotmail.com
Fri Oct 4 21:39:30 UTC 2024
https://forum.dlang.org/post/dudpbkerfrdlnggizmpq@forum.dlang.org
On Saturday, 1 October 2022 at 03:14:44 UTC, mw wrote:
> extern(C++)?
>
> Why do you think Rust export C++ linkage?
>
Rust support [two mangling
version](https://doc.rust-lang.org/rustc/symbol-mangling/index.html#mangling-versions)
: `legacy` (C++ compatible) and `v0` (theoretical equivalent to
`extern(D)`). Until the 2021 edition, legacy is still the default.
> Do it in plain C style, you may make it work.
C ABI is more practical and stable. However, there are cases
where adapting to the C style can be limiting compared to
C++/D/Rust using more advanced features, including generic
programming.
An example of this is the use of cbindgen which mixes C with
`cpp_compat`.
More information about the Digitalmars-d-learn
mailing list