I was trying to create a minimal win32 application with WinMain as an entry point. So zig init-exe and put this into the main.zig:
const std = @import("std");
const win = std.os.windows;
// Forgot "export" here
pub fn WinMain(hInstance: win.HINSTANCE, hPrevInstance: win.HINSTANCE, lpCmdLine: win.PWSTR, nCmdShow: win.INT) win.INT {
return 0;
}
Notice that I forgot to put "export" after "pub". When I do this, zig build exits with status 1 and doesn't provide any error message. Even --verbose won't help.
While I know what mistake have I made, I still think it would be helpful to provide at least some kind of a clue to the user about what happened.
UPD zig version is 0.6.0+7f7e2d608
This is not a stage1 bug, this is an upstream LLD bug: #3825
Here's an open invitation to send a friendly pull request to LLD upstream which fixes it so that it actually reports errors rather than calling exit(1).
Most helpful comment
This is not a stage1 bug, this is an upstream LLD bug: #3825
Here's an open invitation to send a friendly pull request to LLD upstream which fixes it so that it actually reports errors rather than calling exit(1).