I have a rust project in which I need to define a symbol (presumably a top-level
static, see below) with a very specific name. However, even with
#[no_mangle] cargo/rustc seems to mangle the name a little bit, by prepending
_. So if I need the symbol
foo, it gets mangled to
I need that mangling to stop, ideally for only that symbol so as not to disturb anything else. How can I deactivate it?
A bit of background: I need to compile the project to work in a C environment which requires a global symbol to be defined with a certain name (and as a C
int. So far my
pub static mut FOO: std::os::raw::c_int; declaration seems to come closest to what I need).
The environment doesn’t actually do anything with the symbol, it just requires the its presence.