From 87bc97daefc8b5d8b665ea2fb2b6c232b80344bc Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 22 Mar 2017 11:26:30 -0400 Subject: unify main entry point regardless of whether linking libc closes #248 --- std/bootstrap.zig | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'std/bootstrap.zig') diff --git a/std/bootstrap.zig b/std/bootstrap.zig index f520834654..074f06557e 100644 --- a/std/bootstrap.zig +++ b/std/bootstrap.zig @@ -1,17 +1,16 @@ // This file is in a package which has the root source file exposed as "@root". +// It is included in the compilation unit when exporting an executable. const root = @import("@root"); const std = @import("std"); -const want_start_symbol = switch(@compileVar("os")) { - Os.linux => true, - else => false, -}; -const want_main_symbol = !want_start_symbol; +const want_main_symbol = std.build.linkingLibrary("c"); +const want_start_symbol = !want_main_symbol; const exit = switch(@compileVar("os")) { Os.linux => std.linux.exit, Os.darwin => std.darwin.exit, + else => @compileError("Unsupported OS"), }; var argc: usize = undefined; -- cgit v1.2.3