Closed
Description
#[link(name="bad")]
fn main() {
}
compiles without warnings. I would expect warning that the link is unused or in the wrong place.
This causes a gotcha: if you insert any code between link
and extern
you suddenly get linker errors, because there's no -llibrary
flag added.
#[link(name="library")]
struct SURPRISE();
extern {
pub fn library() -> ();
}
fn main() {
unsafe {
library();
}
}
I've got bitten by this when I've moved #[link]
next to extern crate
and #![crate_id]
statements that I thought it belongs with.
Metadata
Metadata
Assignees
Labels
No labels