I am trying to export a character from the Rust executable:
#[allow(non_upper_case_globals)]
#[no_mangle]
pub static exported_symbol: [u8; 1] = *b"\0";
fn main() {
println!("Hello, world!");
}
exported_symbol not output as a result of a binary file:
$ cargo build
$ nm ./target/debug/test_export| grep exported_symbol
On the other hand, if I create a library with the same source, the symbol is exported:
$ rustc --crate-type cdylib src/main.rs
$ nm libmain.so| grep exported_symbol
0000000000016c10 R exported_symbol
I am using Rust 1.18.0 for Linux x86-64.
source
share