summaryrefslogtreecommitdiff
path: root/src/ir/function.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ir/function.rs')
-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'); }
+ _ => {}
+ }
}
}