-
-
Save geofft/493c5c17bfdd04b97670 to your computer and use it in GitHub Desktop.
#[no_mangle] is unsafe
This file contains hidden or 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() { | |
| println!("{} {}", b::identity(), c::identity()); | |
| } |
This file contains hidden or 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="lib"] | |
| #[no_mangle] | |
| pub fn identity() -> &'static str { | |
| "b" | |
| } |
This file contains hidden or 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="lib"] | |
| #[no_mangle] | |
| pub fn identity() -> &'static str { | |
| "c" | |
| } |
This file contains hidden or 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
| geofft@titan:/tmp/libparty$ rustc b.rs | |
| geofft@titan:/tmp/libparty$ rustc c.rs | |
| geofft@titan:/tmp/libparty$ rustc a.rs -L . | |
| geofft@titan:/tmp/libparty$ ./a | |
| b b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment