Closed
Description
It doesn't seem possible to use 'extern mod' inside of a module.
in file cratey.rs:
#[ link(name = "cratey",
vers = "0.1",
uuid = "418CE8FB-DE11-4FEF-BC71-E3F36047696F") ];
#[ crate_type = "lib" ];
pub fn add1 (x : int) -> int { x + 1 }
In the same directory, crateuser.rs:
pub mod mymod {
extern mod cratey;
use cratey::add1;
fn main() { add1(3); }
}
compilation of the crate works fine, but linking against it causes an error:
machine> rustc cratey.rs
Running /Users/clements/rust/build/x86_64-apple-darwin/stage2/bin/rustc:
warning: no debug symbols in executable (-arch x86_64)
machine> rustc -L . crateuser.rs
Running /Users/clements/rust/build/x86_64-apple-darwin/stage2/bin/rustc:
crateuser.rs:6:4: 6:17 error: unresolved name
crateuser.rs:6 use cratey::add1;
^~~~~~~~~~~~~
crateuser.rs:6:4: 6:17 error: failed to resolve import: cratey::add1
crateuser.rs:6 use cratey::add1;
^~~~~~~~~~~~~
error: failed to resolve imports
error: aborting due to 3 previous errors
Removing the "mod mymod" wrapper allows the thing to compile fine. Apologies if this is the way it's supposed to work; casual stand-up-and-shout suggests to me that it should be possible to put an extern mod inside a module.
Metadata
Metadata
Assignees
Labels
No labels