r/cpp • • Oct 24 '24

Why Safety Profiles Failed

https://www.circle-lang.org/draft-profiles.html
181 Upvotes

347 comments sorted by

View all comments

Show parent comment

6

u/pjmlp Oct 26 '24

It works the same way as many languages, it is supported, with the caveat that the same toolchain is to be used for application and libraries, as to be expected.

There are a few workarounds, the usual provide only a C ABI, with the usual constraints, or make use of libraries that do that while putting a mini ABI for a Rust subset.

Even ecosystems that have more stable ABIs like Swift, or the bytecode based ones, it isn't 100% works all the time, there are some caveats when mixing language versions.

5

u/Low_Pickle_5934 Oct 28 '24

Rust is actually working on an extern "crabi" feature to interop much better with languages like swift AFAIK. E.g. so you can define Vec<i32> as a param in a dll.

7

u/[deleted] Oct 26 '24

It works the same way as many languages, it is supported, with the caveat that the same toolchain is to be used for application and libraries, as to be expected.

Atleast officially, rust famously doesn't guarantee ABI stability even between two cargo runs.

Type layout can be changed with each compilation.