unify main entry point regardless of whether linking libc

closes #248
This commit is contained in:
Andrew Kelley
2017-03-22 11:26:30 -04:00
parent e1c47d6fe8
commit 87bc97daef
12 changed files with 86 additions and 57 deletions

View File

@@ -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;