diff options
| author | LemonBoy <thatlemon@gmail.com> | 2020-01-09 10:36:51 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-01-09 13:43:06 -0500 |
| commit | 5ab5de89c03bf9b3f08dfaa78d3b0fe41a72cdea (patch) | |
| tree | c93dcfb6b6dad6d52d8d03e1d1a4601da5f04a3c /lib/std/start.zig | |
| parent | 4613e4d15f85406d23f91134a9ec5854da33965f (diff) | |
| download | zig-5ab5de89c03bf9b3f08dfaa78d3b0fe41a72cdea.tar.gz zig-5ab5de89c03bf9b3f08dfaa78d3b0fe41a72cdea.zip | |
New @export() handling
Use a struct as second parameter to be future proof (and also allows to
specify default values for the parameters)
Closes #2679 as it was just a matter of a few lines of code.
Diffstat (limited to 'lib/std/start.zig')
| -rw-r--r-- | lib/std/start.zig | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/std/start.zig b/lib/std/start.zig index 7c1353e18b..b982692a08 100644 --- a/lib/std/start.zig +++ b/lib/std/start.zig @@ -22,23 +22,23 @@ const start_sym_name = if (is_mips) "__start" else "_start"; comptime { if (builtin.output_mode == .Lib and builtin.link_mode == .Dynamic) { if (builtin.os == .windows and !@hasDecl(root, "_DllMainCRTStartup")) { - @export("_DllMainCRTStartup", _DllMainCRTStartup, .Strong); + @export(_DllMainCRTStartup, .{ .name = "_DllMainCRTStartup" }); } } else if (builtin.output_mode == .Exe or @hasDecl(root, "main")) { if (builtin.link_libc and @hasDecl(root, "main")) { if (@typeInfo(@TypeOf(root.main)).Fn.calling_convention != .C) { - @export("main", main, .Weak); + @export(main, .{ .name = "main", .linkage = .Weak }); } } else if (builtin.os == .windows) { if (!@hasDecl(root, "WinMain") and !@hasDecl(root, "WinMainCRTStartup")) { - @export("WinMainCRTStartup", WinMainCRTStartup, .Strong); + @export(WinMainCRTStartup, .{ .name = "WinMainCRTStartup" }); } } else if (builtin.os == .uefi) { - if (!@hasDecl(root, "EfiMain")) @export("EfiMain", EfiMain, .Strong); + if (!@hasDecl(root, "EfiMain")) @export(EfiMain, .{ .name = "EfiMain" }); } else if (is_wasm and builtin.os == .freestanding) { - if (!@hasDecl(root, start_sym_name)) @export(start_sym_name, wasm_freestanding_start, .Strong); + if (!@hasDecl(root, start_sym_name)) @export(wasm_freestanding_start, .{ .name = start_sym_name }); } else if (builtin.os != .other and builtin.os != .freestanding) { - if (!@hasDecl(root, start_sym_name)) @export(start_sym_name, _start, .Strong); + if (!@hasDecl(root, start_sym_name)) @export(_start, .{ .name = start_sym_name }); } } } |
