| ... | ... | @@ -28,6 +28,8 @@ comptime { |
| 28 | 28 | if (@typeInfo(@TypeOf(root.main)).Fn.calling_convention != .C) { |
| 29 | 29 | @export(main2, .{ .name = "main" }); |
| 30 | 30 | } |
| 31 | } else if (builtin.stage2_os == .windows) { |
| 32 | @export(wWinMainCRTStartup2, .{ .name = "wWinMainCRTStartup" }); |
| 31 | 33 | } else { |
| 32 | 34 | if (!@hasDecl(root, "_start")) { |
| 33 | 35 | @export(_start2, .{ .name = "_start" }); |
| ... | ... | @@ -96,6 +98,11 @@ fn callMain2() noreturn { |
| 96 | 98 | exit2(0); |
| 97 | 99 | } |
| 98 | 100 | |
| 101 | fn wWinMainCRTStartup2() callconv(.C) noreturn { |
| 102 | root.main(); |
| 103 | exit2(0); |
| 104 | } |
| 105 | |
| 99 | 106 | fn exit2(code: usize) noreturn { |
| 100 | 107 | switch (native_os) { |
| 101 | 108 | .linux => switch (builtin.stage2_arch) { |
| ... | ... | @@ -148,11 +155,16 @@ fn exit2(code: usize) noreturn { |
| 148 | 155 | }, |
| 149 | 156 | else => @compileError("TODO"), |
| 150 | 157 | }, |
| 158 | .windows => { |
| 159 | ExitProcess(@truncate(u32, code)); |
| 160 | }, |
| 151 | 161 | else => @compileError("TODO"), |
| 152 | 162 | } |
| 153 | 163 | unreachable; |
| 154 | 164 | } |
| 155 | 165 | |
| 166 | extern "kernel32" fn ExitProcess(exit_code: u32) callconv(.C) noreturn; |
| 167 | |
| 156 | 168 | //////////////////////////////////////////////////////////////////////////////// |
| 157 | 169 | |
| 158 | 170 | fn _DllMainCRTStartup( |