Skip to content

Commit

Permalink
Decides main name by target
Browse files Browse the repository at this point in the history
  • Loading branch information
ILyoan committed Apr 4, 2013
1 parent f064048 commit fac0d9d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/librustc/middle/trans/base.rs
Expand Up @@ -2243,17 +2243,17 @@ pub fn create_main_wrapper(ccx: @CrateContext,
}

fn create_entry_fn(ccx: @CrateContext, rust_main: ValueRef) {
#[cfg(windows)]
fn main_name() -> ~str { return ~"WinMain@16"; }
#[cfg(unix)]
fn main_name() -> ~str { return ~"main"; }
let llfty = T_fn(~[ccx.int_type, T_ptr(T_ptr(T_i8()))], ccx.int_type);

// FIXME #4404 android JNI hacks
let llfn = if *ccx.sess.building_library {
decl_cdecl_fn(ccx.llmod, ~"amain", llfty)
} else {
decl_cdecl_fn(ccx.llmod, main_name(), llfty)
let main_name = match ccx.sess.targ_cfg.os {
session::os_win32 => ~"WinMain@16",
_ => ~"main",
};
decl_cdecl_fn(ccx.llmod, main_name, llfty)
};
let llbb = str::as_c_str(~"top", |buf| {
unsafe {
Expand Down

0 comments on commit fac0d9d

Please sign in to comment.