summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXidorn Quan <me@upsuper.org>2017-07-18 15:12:32 +1000
committerXidorn Quan <me@upsuper.org>2017-07-18 16:53:34 +1000
commit4f8de62f4585ce40c9b10b3ddc9f9f99b681549b (patch)
treec08b5ab97c0a7bdd3abc256271b883489c1b511c /src
parent75c587571f38746e98f18f56c29dd7ae8884680c (diff)
Stop Rust from prepending underscore before '?' for win32
Diffstat (limited to 'src')
-rw-r--r--src/ir/function.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ir/function.rs b/src/ir/function.rs
index 9865997d..5fa95203 100644
--- a/src/ir/function.rs
+++ b/src/ir/function.rs
@@ -130,7 +130,14 @@ fn get_abi(cc: CXCallingConv) -> Abi {
fn mangling_hack_if_needed(ctx: &BindgenContext, symbol: &mut String) {
if ctx.needs_mangling_hack() {
- symbol.remove(0);
+ match symbol.chars().next().unwrap() {
+ // Stripping leading underscore for all names on Darwin and
+ // C linkage functions on Win32.
+ '_' => { symbol.remove(0); }
+ // Stop Rust from prepending underscore for variables on Win32.
+ '?' => { symbol.insert(0, '\x01'); }
+ _ => {}
+ }
}
}