-
-
Save retep998/808ad305508486b7743ec44444f15b65 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![crate_type = "dylib"] | |
pub const FOO: &str = "FOO"; | |
pub static BAR: &str = "BAR"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![crate_type = "dylib"] | |
extern crate a; | |
pub fn doit() { | |
println!("b const {:?}", a::FOO as *const str); | |
println!("b static {:?}", a::BAR as *const str); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![crate_type = "dylib"] | |
extern crate a; | |
pub fn doit() { | |
println!("c const {:?}", a::FOO as *const str); | |
println!("c static {:?}", a::BAR as *const str); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate b; | |
extern crate c; | |
fn main() { | |
b::doit(); | |
c::doit(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> rustc a.rs -Cprefer-dynamic; rustc b.rs -L.; rustc c.rs -L.; rustc d.rs -L.; ./d.exe | |
b const 0x7ffdfd2821b0 | |
b static 0x7ffdf6552150 | |
c const 0x7ffdfe4f21b0 | |
c static 0x7ffdf6552150 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment