authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-12-03 13:10:26-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-12-03 13:10:26-05:00
log8db4d2332e62ba31412b28e725f4c4ae3b7dd801
tree5e133da5eb01424b0c0634029b191d83d485bf79
parenta91f55239369b4401aaa50a74ed939f5eb98395d
signature Commit is signed but in an unrecognized format.

correct startup logic for exporting libc main


1 files changed, 4 insertions(+), 4 deletions(-)

lib/std/special/start.zig+4-4
...@@ -24,10 +24,10 @@ comptime {...@@ -24,10 +24,10 @@ comptime {
24 @export("_DllMainCRTStartup", _DllMainCRTStartup, .Strong);24 @export("_DllMainCRTStartup", _DllMainCRTStartup, .Strong);
25 }25 }
26 } else if (builtin.output_mode == .Exe or @hasDecl(root, "main")) {26 } else if (builtin.output_mode == .Exe or @hasDecl(root, "main")) {
27 if (builtin.link_libc and @hasDecl(root, "main") and27 if (builtin.link_libc and @hasDecl(root, "main")) {
28 @typeInfo(@typeOf(root.main)).Fn.calling_convention != .C)28 if (@typeInfo(@typeOf(root.main)).Fn.calling_convention != .C) {
29 {29 @export("main", main, .Weak);
30 @export("main", main, .Weak);30 }
31 } else if (builtin.os == .windows) {31 } else if (builtin.os == .windows) {
32 if (!@hasDecl(root, "WinMain") and !@hasDecl(root, "WinMainCRTStartup")) {32 if (!@hasDecl(root, "WinMain") and !@hasDecl(root, "WinMainCRTStartup")) {
33 @export("WinMainCRTStartup", WinMainCRTStartup, .Strong);33 @export("WinMainCRTStartup", WinMainCRTStartup, .Strong);