-
Couldn't load subscription status.
- Fork 13.9k
Closed
Description
The documentation for the --extern rustc command line flag seems to suggest it's functionally identical to extern crate.
Specifically:
The given crate name is added to the extern prelude, which is the same as specifying extern crate within the root module.
However, if there are #[no_mangle] symbols in the crate, then consumed into a staticlib there's a difference. I don't know if this is intentional, and/or whether I'm misinterpreting the documentation, so I'm raising an issue to ask rather than filing a PR against the documentation.
Do this:
- cd client
./build-a.sh. This usesextern crate rlib;and should successfully build a C executable including a Rust symbol../build-b.sh. This uses--externand instead reports:
Undefined symbols for architecture x86_64:
"_do_some_maths", referenced from:
_main in test-2e4db9.o
ld: symbol(s) not found for architecture x86_64
rustc 1.45.0-nightly (a08c47310 2020-05-07)
Metadata
Metadata
Assignees
Labels
No labels