Skip to content

Commit c1fb592

Browse files
committed
Emit WinMain@16 entrypoint on windows.
1 parent 981edae commit c1fb592

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/comp/middle/trans.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1197,8 +1197,15 @@ fn trans_main_fn(@trans_ctxt cx, ValueRef llcrate) {
11971197
auto T_main_args = vec(T_int(), T_int());
11981198
auto T_rust_start_args = vec(T_int(), T_int(), T_int(), T_int());
11991199

1200+
auto main_name;
1201+
if (_str.eq(std.os.target_os(), "win32")) {
1202+
main_name = "WinMain@16";
1203+
} else {
1204+
main_name = "main";
1205+
}
1206+
12001207
auto llmain =
1201-
decl_cdecl_fn(cx.llmod, "main", T_main_args, T_int());
1208+
decl_cdecl_fn(cx.llmod, main_name, T_main_args, T_int());
12021209

12031210
auto llrust_start =
12041211
decl_cdecl_fn(cx.llmod, "rust_start", T_rust_start_args, T_int());

0 commit comments

Comments
 (0)