aboutsummaryrefslogtreecommitdiff
path: root/lib/c/common.zig
diff options
context:
space:
mode:
Diffstat (limited to 'lib/c/common.zig')
-rw-r--r--lib/c/common.zig15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/c/common.zig b/lib/c/common.zig
new file mode 100644
index 0000000000..e9536f63b4
--- /dev/null
+++ b/lib/c/common.zig
@@ -0,0 +1,15 @@
+const builtin = @import("builtin");
+const std = @import("std");
+
+pub const linkage: std.builtin.GlobalLinkage = if (builtin.is_test)
+ .internal
+else
+ .strong;
+
+/// Determines the symbol's visibility to other objects.
+/// For WebAssembly this allows the symbol to be resolved to other modules, but will not
+/// export it to the host runtime.
+pub const visibility: std.builtin.SymbolVisibility = if (builtin.cpu.arch.isWasm() and linkage != .internal)
+ .hidden
+else
+ .default;