Skip to content

Commit

Permalink
Use the correct calling convention for extern rust functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
eholk committed Nov 19, 2013
1 parent 50fb4be commit 5b534e4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/librustc/middle/trans/foreign.rs
Expand Up @@ -399,11 +399,19 @@ pub fn register_rust_fn_with_foreign_abi(ccx: @mut CrateContext,

let tys = foreign_types_for_id(ccx, node_id);
let llfn_ty = lltype_for_fn_from_foreign_types(&tys);
let t = ty::node_id_to_type(ccx.tcx, node_id);
let cconv = match ty::get(t).sty {
ty::ty_bare_fn(ref fn_ty) => {
let c = llvm_calling_convention(ccx, fn_ty.abis);
c.unwrap_or(lib::llvm::CCallConv)
}
_ => lib::llvm::CCallConv
};
let llfn = base::register_fn_llvmty(ccx,
sp,
sym,
node_id,
lib::llvm::CCallConv,
cconv,
llfn_ty);
add_argument_attributes(&tys, llfn);
debug!("register_rust_fn_with_foreign_abi(node_id={:?}, llfn_ty={}, llfn={})",
Expand Down

4 comments on commit 5b534e4

@bors
Copy link
Contributor

@bors bors commented on 5b534e4 Nov 19, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at eholk@5b534e4

@bors
Copy link
Contributor

@bors bors commented on 5b534e4 Nov 19, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging eholk/rust/win64 = 5b534e4 into auto

@bors
Copy link
Contributor

@bors bors commented on 5b534e4 Nov 19, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eholk/rust/win64 = 5b534e4 merged ok, testing candidate = 335a476c

@bors
Copy link
Contributor

@bors bors commented on 5b534e4 Nov 19, 2013

Please sign in to comment.