mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Decides main name by target
This commit is contained in:
parent
f06404860c
commit
fac0d9d89b
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user