summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Lefevre <kevin.lefevre@snips.ai>2017-06-23 18:42:00 +0200
committerKevin Lefevre <kevin.lefevre@snips.ai>2017-06-23 19:07:46 +0200
commit8885365f9fe79c0d0f61476e17e84df2470f43e7 (patch)
tree6bd91e78488be2071c34b2e5da2a164147de1576
parent313d7920a0f1835f516e23c2c84d9dda67ab82fd (diff)
Add mangling hack for ios
-rw-r--r--src/ir/context.rs3
-rw-r--r--tests/expectations/tests/mangling-ios.rs9
-rw-r--r--tests/headers/mangling-ios.h3
3 files changed, 14 insertions, 1 deletions
diff --git a/src/ir/context.rs b/src/ir/context.rs
index 7b4e9b6a..b14d963b 100644
--- a/src/ir/context.rs
+++ b/src/ir/context.rs
@@ -261,7 +261,7 @@ impl<'ctx> BindgenContext<'ctx> {
effective_target = Some(HOST_TARGET.to_owned());
}
- // Mac os and Win32 need __ for mangled symbols but rust will automatically
+ // Mac os, iOS and Win32 need __ for mangled symbols but rust will automatically
// prepend the extra _.
//
// We need to make sure that we don't include __ because rust will turn into
@@ -269,6 +269,7 @@ impl<'ctx> BindgenContext<'ctx> {
let effective_target = effective_target.unwrap();
let needs_mangling_hack =
effective_target.contains("darwin") ||
+ effective_target.contains("ios") ||
effective_target == "i686-pc-win32";
let root_module = Self::build_root_module(ItemId(0));
diff --git a/tests/expectations/tests/mangling-ios.rs b/tests/expectations/tests/mangling-ios.rs
new file mode 100644
index 00000000..87df5e4a
--- /dev/null
+++ b/tests/expectations/tests/mangling-ios.rs
@@ -0,0 +1,9 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
+
+
+extern "C" {
+ pub fn foo();
+}
diff --git a/tests/headers/mangling-ios.h b/tests/headers/mangling-ios.h
new file mode 100644
index 00000000..d3a0cd78
--- /dev/null
+++ b/tests/headers/mangling-ios.h
@@ -0,0 +1,3 @@
+// bindgen-flags: -- --target=x86_64-apple-ios
+
+void foo();