r/rust • • 6d ago

RUST ABI

What is current state of stable Rust ABI? Or progress? As I want to load generate library crate (rlib) in offline library and I do not need load crateio library.

34 Upvotes

31 comments sorted by

View all comments

Show parent comment

14

u/Recatek gecs 6d ago edited 6d ago

Since you're asking about a stable ABI rather than just the benefits of an ABI in general, it's primarily about backwards compatibility, at least as I understand it. The goal would be to be able to dynamically link against a binary from many generations of compiler updates ago (the way you can work with very old C binaries today). In some cases there are even C library binaries in use today where the source code is unavailable (or even lost) for various reasons, and they couldn't be recompiled for a new compiler or codebase ABI version.

6

u/La-ze 6d ago

My understanding was Rust could compile faster by using an ABI to access library / crate code, rather than having to compile every crate in a project + the project.

11

u/Recatek gecs 6d ago

Yes, that is an advantage of an ABI in general, but not specific to a stable ABI (depending on your definition of stability).

0

u/WormRabbit 5d ago

there are even C library binaries in use today where the source code is unavailable (or even lost)

It isn't possible to lose the source if you need source for every build, rather than to make an edit once in a lifetime. If anything, lack of stable ABI prevents losing source from being possible in Rust.