Skip to content

Commit 8885365

Browse files
author
Kevin Lefevre
committed
Add mangling hack for ios
1 parent 313d792 commit 8885365

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

src/ir/context.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,14 +261,15 @@ impl<'ctx> BindgenContext<'ctx> {
261261
effective_target = Some(HOST_TARGET.to_owned());
262262
}
263263

264-
// Mac os and Win32 need __ for mangled symbols but rust will automatically
264+
// Mac os, iOS and Win32 need __ for mangled symbols but rust will automatically
265265
// prepend the extra _.
266266
//
267267
// We need to make sure that we don't include __ because rust will turn into
268268
// ___.
269269
let effective_target = effective_target.unwrap();
270270
let needs_mangling_hack =
271271
effective_target.contains("darwin") ||
272+
effective_target.contains("ios") ||
272273
effective_target == "i686-pc-win32";
273274

274275
let root_module = Self::build_root_module(ItemId(0));
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* automatically generated by rust-bindgen */
2+
3+
4+
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
5+
6+
7+
extern "C" {
8+
pub fn foo();
9+
}

tests/headers/mangling-ios.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// bindgen-flags: -- --target=x86_64-apple-ios
2+
3+
void foo();

0 commit comments

Comments
 (0)