diff --git a/lib/c.zig b/lib/c.zig index d742258607..927d71d82f 100644 --- a/lib/c.zig +++ b/lib/c.zig @@ -38,8 +38,6 @@ comptime { @export(&strncpy, .{ .name = "strncpy", .linkage = .strong }); @export(&strcat, .{ .name = "strcat", .linkage = .strong }); @export(&strncat, .{ .name = "strncat", .linkage = .strong }); - } else if (is_msvc) { - @export(&_fltused, .{ .name = "_fltused", .linkage = .strong }); } } @@ -62,8 +60,6 @@ fn wasm_start() callconv(.C) void { _ = main(0, undefined); } -var _fltused: c_int = 1; - fn strcpy(dest: [*:0]u8, src: [*:0]const u8) callconv(.C) [*:0]u8 { var i: usize = 0; while (src[i] != 0) : (i += 1) { diff --git a/lib/compiler_rt.zig b/lib/compiler_rt.zig index 9628ea4f3b..02d3f75c5b 100644 --- a/lib/compiler_rt.zig +++ b/lib/compiler_rt.zig @@ -1,6 +1,7 @@ const builtin = @import("builtin"); +const common = @import("compiler_rt/common.zig"); -pub const panic = @import("compiler_rt/common.zig").panic; +pub const panic = common.panic; comptime { // Integer routines @@ -236,4 +237,10 @@ comptime { _ = @import("compiler_rt/bcmp.zig"); _ = @import("compiler_rt/ssp.zig"); } + + if (!builtin.link_libc and builtin.abi == .msvc) { + @export(&_fltused, .{ .name = "_fltused", .linkage = common.linkage, .visibility = common.visibility }); + } } + +var _fltused: c_int = 1;