zig build exits abnormally with code 1 without any error message when incorrectly specifying main entry point

Created on 13 Oct 2020  路  1Comment  路  Source: ziglang/zig

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

bug

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).

>All comments

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).

Was this page helpful?
0 / 5 - 0 ratings