Closed
Description
On Zig 0.5.0+a11da3773.
zig build-exe ../src/test.zig --subsystem windows
C:\dev\Zig\lib\zig\std\special\start.zig:227:35: error: root source file has no member called 'main'
usingnamespace @import("std").os.windows;
extern "user32" stdcallcc fn MessageBoxA(hWnd: ?HANDLE, lpText: ?LPCTSTR, lpCaption: ?LPCTSTR, uType: UINT) c_int;
export stdcallcc fn WinMain(hInstance: ?HINSTANCE, hPrevInstance: ?HINSTANCE, lpCmdLine: ?LPWSTR, nShowCmd: INT) INT {
_ = MessageBoxA(null, c"hello", c"world", 0);
return 0;
}
Interestingly, the error is only prompted if stdcallcc is not provided, but it's required otherwise the parameters are not accessible to the function as the calling convention is not observed.
If main() is defined then WinMain() is never called.