mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
fix objc ABI in std::env::args
This commit is contained in:
parent
24175e8c9f
commit
a1882ca769
@ -172,10 +172,23 @@ mod imp {
|
||||
|
||||
extern {
|
||||
fn sel_registerName(name: *const libc::c_uchar) -> Sel;
|
||||
fn objc_msgSend(obj: NsId, sel: Sel, ...) -> NsId;
|
||||
fn objc_getClass(class_name: *const libc::c_uchar) -> NsId;
|
||||
}
|
||||
|
||||
#[cfg(target_arch="aarch64")]
|
||||
extern {
|
||||
fn objc_msgSend(obj: NsId, sel: Sel) -> NsId;
|
||||
#[link_name="objc_msgSend"]
|
||||
fn objc_msgSend_ul(obj: NsId, sel: Sel, i: libc::c_ulong) -> NsId;
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch="aarch64"))]
|
||||
extern {
|
||||
fn objc_msgSend(obj: NsId, sel: Sel, ...) -> NsId;
|
||||
#[link_name="objc_msgSend"]
|
||||
fn objc_msgSend_ul(obj: NsId, sel: Sel, ...) -> NsId;
|
||||
}
|
||||
|
||||
#[link(name = "Foundation", kind = "framework")]
|
||||
#[link(name = "objc")]
|
||||
#[cfg(not(cargobuild))]
|
||||
@ -199,7 +212,7 @@ mod imp {
|
||||
|
||||
let cnt: usize = mem::transmute(objc_msgSend(args, count_sel));
|
||||
for i in 0..cnt {
|
||||
let tmp = objc_msgSend(args, object_at_sel, i);
|
||||
let tmp = objc_msgSend_ul(args, object_at_sel, i as libc::c_ulong);
|
||||
let utf_c_str: *const libc::c_char =
|
||||
mem::transmute(objc_msgSend(tmp, utf8_sel));
|
||||
let bytes = CStr::from_ptr(utf_c_str).to_bytes();
|
||||
|
Loading…
Reference in New Issue
Block a user