about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorILyoan <ilyoan@gmail.com>2013-04-03 15:44:26 +0900
committerILyoan <ilyoan@gmail.com>2013-04-04 10:44:48 +0900
commitfac0d9d89bd55eccda2549d59b5355afdcaa783f (patch)
tree5b3697fbd024b42303d0d1117696a7c3fa816b2b /src
parentf06404860ce4c083461483b41879ae40f08a3fc2 (diff)
downloadrust-fac0d9d89bd55eccda2549d59b5355afdcaa783f.tar.gz
rust-fac0d9d89bd55eccda2549d59b5355afdcaa783f.zip
Decides main name by target
Diffstat (limited to 'src')
-rw-r--r--src/librustc/middle/trans/base.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs
index 5c5f78aeab6..a8fe60ba68e 100644
--- a/src/librustc/middle/trans/base.rs
+++ b/src/librustc/middle/trans/base.rs
@@ -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 {