authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2019-12-01 11:31:18+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-12-03 12:50:42-05:00
log621c08e692256af9b0cc5ef6438b0ecf547e2b38
treeec6b53315205aa48eb1c048971faa9cf0c083efe
parent20bcdab462dc21dc912da3ce4deb432a81cbc3c5
signature Commit is signed but in an unrecognized format.

exported main must be pub


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

lib/std/special/start.zig+1-1
......@@ -23,7 +23,7 @@ comptime {
2323 .Unknown => unreachable,
2424 .Exe => {
2525 if (builtin.link_libc) {
26 if (!@hasDecl(root, "main") or
26 if (@hasDecl(root, "main") and
2727 @typeInfo(@typeOf(root.main)).Fn.calling_convention != .C)
2828 {
2929 @export("main", main, .Weak);
test/compare_output.zig+4-4
......@@ -6,7 +6,7 @@ const tests = @import("tests.zig");
66pub fn addCases(cases: *tests.CompareOutputContext) void {
77 cases.addC("hello world with libc",
88 \\const c = @cImport(@cInclude("stdio.h"));
9 \\export fn main(argc: c_int, argv: [*][*]u8) c_int {
9 \\pub export fn main(argc: c_int, argv: [*][*]u8) c_int {
1010 \\ _ = c.puts("Hello, world!");
1111 \\ return 0;
1212 \\}
......@@ -139,7 +139,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
139139 \\ @cInclude("stdio.h");
140140 \\});
141141 \\
142 \\export fn main(argc: c_int, argv: [*][*]u8) c_int {
142 \\pub export fn main(argc: c_int, argv: [*][*]u8) c_int {
143143 \\ if (is_windows) {
144144 \\ // we want actual \n, not \r\n
145145 \\ _ = c._setmode(1, c._O_BINARY);
......@@ -286,7 +286,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
286286 \\ }
287287 \\}
288288 \\
289 \\export fn main() c_int {
289 \\pub export fn main() c_int {
290290 \\ var array = [_]u32{ 1, 7, 3, 2, 0, 9, 4, 8, 6, 5 };
291291 \\
292292 \\ c.qsort(@ptrCast(?*c_void, array[0..].ptr), @intCast(c_ulong, array.len), @sizeOf(i32), compare_fn);
......@@ -314,7 +314,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
314314 \\ @cInclude("stdio.h");
315315 \\});
316316 \\
317 \\export fn main(argc: c_int, argv: [*][*]u8) c_int {
317 \\pub export fn main(argc: c_int, argv: [*][*]u8) c_int {
318318 \\ if (is_windows) {
319319 \\ // we want actual \n, not \r\n
320320 \\ _ = c._setmode(1, c._O_BINARY);
test/stage2/compare_output.zig+2-2
......@@ -5,7 +5,7 @@ pub fn addCases(ctx: *TestContext) !void {
55 // hello world
66 try ctx.testCompareOutputLibC(
77 \\extern fn puts([*]const u8) void;
8 \\export fn main() c_int {
8 \\pub export fn main() c_int {
99 \\ puts("Hello, world!");
1010 \\ return 0;
1111 \\}
......@@ -14,7 +14,7 @@ pub fn addCases(ctx: *TestContext) !void {
1414 // function calling another function
1515 try ctx.testCompareOutputLibC(
1616 \\extern fn puts(s: [*]const u8) void;
17 \\export fn main() c_int {
17 \\pub export fn main() c_int {
1818 \\ return foo("OK");
1919 \\}
2020 \\fn foo(s: [*]const u8) c_int {
test/standalone/hello_world/hello_libc.zig+1-1
......@@ -7,7 +7,7 @@ const c = @cImport({
77
88const msg = "Hello, world!\n";
99
10export fn main(argc: c_int, argv: **u8) c_int {
10pub export fn main(argc: c_int, argv: **u8) c_int {
1111 if (c.printf(msg) != @intCast(c_int, c.strlen(msg))) return -1;
1212 return 0;
1313}