Created
September 4, 2019 19:50
-
-
Save nikhilm/a72d89002553ecab4511fbe77df223cc to your computer and use it in GitHub Desktop.
rustc staticlib bug
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
[package] | |
edition = "2018" | |
name = "hello_world" | |
version = "0.1.0" | |
[lib] | |
crate-type = ["staticlib"] | |
name = "hello_world" | |
[dependencies] | |
# Can be any crate really. Just needed something small. | |
bitflags = "1.1.0" | |
[profile.release] | |
lto = "thin" |
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
#[macro_use] | |
extern crate bitflags; | |
bitflags! { | |
struct Flags: u32 { | |
const A = 0b00000001; | |
const B = 0b00000010; | |
const C = 0b00000100; | |
const ABC = Self::A.bits | Self::B.bits | Self::C.bits; | |
} | |
} | |
#[no_mangle] | |
pub extern "C" fn hello_world(x: usize) { | |
let e1 = Flags::A | Flags::C; | |
println!("oh hey there {} {:?}", x, Flags::empty()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment