| ... | ... | @@ -511,9 +511,9 @@ inline fn initEventLoopAndCallWinMain() std.os.windows.INT { |
| 511 | 511 | }; |
| 512 | 512 | defer loop.deinit(); |
| 513 | 513 | |
| 514 | | var result: u8 = undefined; |
| 515 | | var frame: @Frame(callMainAsync) = undefined; |
| 516 | | _ = @asyncCall(&frame, &result, callMainAsync, .{loop}); |
| 514 | var result: std.os.windows.INT = undefined; |
| 515 | var frame: @Frame(callWinMainAsync) = undefined; |
| 516 | _ = @asyncCall(&frame, &result, callWinMainAsync, .{loop}); |
| 517 | 517 | loop.run(); |
| 518 | 518 | return result; |
| 519 | 519 | } |
| ... | ... | @@ -532,6 +532,14 @@ fn callMainAsync(loop: *std.event.Loop) callconv(.Async) u8 { |
| 532 | 532 | return callMain(); |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | fn callWinMainAsync(loop: *std.event.Loop) callconv(.Async) std.os.windows.INT { |
| 536 | // This prevents the event loop from terminating at least until main() has returned. |
| 537 | // TODO This shouldn't be needed here; it should be in the event loop code. |
| 538 | loop.beginOneEvent(); |
| 539 | defer loop.finishOneEvent(); |
| 540 | return call_wWinMain(); |
| 541 | } |
| 542 | |
| 535 | 543 | // This is not marked inline because it is called with @asyncCall when |
| 536 | 544 | // there is an event loop. |
| 537 | 545 | pub fn callMain() u8 { |