Support dynamic linking with Rust ABI and not C ABI
Nobody has claimed this yet.
- Dominant language
- Markdown
- Stars
- 6.6k
- Forks
- 1.7k
- Avg merge
- 16h 14m
- Merged PRs (30d)
- 1
Description
Now I know the rust team has shot down the idea of having stable ABI, and I am in favor of it, but there is a way to support dynamic linking with Rust ABI without defining a stable ABI. It is lot more cumbersome, but definitely possible. What I am proposing is that each crate creates a single shared library and exports a symbol like below.
RUSTC_1.49::<Crate>_<version>
This symbol will then be required by the executable linking to this shared library at runtime.
But to achieve this we will have to solve a few questions first
- When including crate version, should we include full version (major.minor.build) or just major.minor?
- Does Cargo currently pass crate versions to rustc, and if not we will have to define a way to do this.
- Expose a mechanism in cargo to build a crate as dynamic library, or use a crate as dynamic library
- Provide a way in cargo to pick a prebuilt shared library, in a way that the above symbol is verified before linking and not during linking
This advantage of supporting this form of shared libraries, is that as long as the rust compiler is same and the whole ecosystem is controlled (like in embedded linux world), we can leverage the use of shared libraries and reduce disk space and memory usage. Both memory and disk space can be a big issue in embedded linux systems.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining the Cargo and rustc questions listed in the issue: crate version propagation, dynamic-library building and use, and prebuilt shared-library selection. A complete result would specify the versioned symbol convention and a Cargo workflow that verifies it before linking; the issue names no files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100