Commit 79ec08fe2f

DixiE <anthonyarian96@gmail.com>
2020-10-23 01:34:32
Fix Compiler Error When Using wWinMain Entry-Point
The fix for #6715 introduced a new compiler error when attempting to use wWinMain as the application entry-point. The Windows API often relies on implicit casts between signed and unsigned variables. In this case, wWinMain returns an INT despite the fact this value is intended to feed into ExitProcess, which expects a UINT, so I've restored the bitcast from #5613.
1 parent ddd39b9
Changed files (1)
lib
lib/std/start.zig
@@ -173,7 +173,8 @@ fn wWinMainCRTStartup() callconv(.Stdcall) noreturn {
 
     std.debug.maybeEnableSegfaultHandler();
 
-    std.os.windows.kernel32.ExitProcess(initEventLoopAndCallWinMain());
+    const result: std.os.windows.INT = initEventLoopAndCallWinMain();
+    std.os.windows.kernel32.ExitProcess(@bitCast(std.os.windows.UINT, result));
 }
 
 // TODO https://github.com/ziglang/zig/issues/265