Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify when dependencies are linked #64731

Closed
dhardy opened this issue Sep 24, 2019 · 1 comment · Fixed by #73567
Closed

Clarify when dependencies are linked #64731

dhardy opened this issue Sep 24, 2019 · 1 comment · Fixed by #73567
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools A-linkage Area: linking into static, shared libraries and binaries C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@dhardy
Copy link
Contributor

dhardy commented Sep 24, 2019

The reference documents that exern crate has some documentation on linkage of dependencies, but appears to relate to Edition 2015 (or at least not mention linking without extern crate).

We are considering use of extern "Rust" and #[no_mangle] for custom backends in getrandom (standalone demo), however before proceeding would like to know:

  1. if we can rely on this poorly documented aspect of the language
  2. why "multiple definition" errors are not always present when declaring multiple backend libs with extern crate
@jonas-schievink jonas-schievink added A-linkage Area: linking into static, shared libraries and binaries C-enhancement Category: An issue proposing an enhancement or a PR with one. A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools labels Sep 24, 2019
@josephlr
Copy link
Contributor

I think this is mainly an issue of documenting @alexcrichton's comment here: #64402 (comment)

To summarize: Cargo dependencies and the --extern rustc flag just make crates candidates for linking, you have to actually use the crate to link it.

@jonas-schievink jonas-schievink added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 6, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jun 23, 2020
@bors bors closed this as completed in a63eb3c Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools A-linkage Area: linking into static, shared libraries and binaries C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants