zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 791e83c22396e029e0f2bc19b75fd86f8cd7851f (tree)
parent 476484f09c98a3a49e0a6be3b92d563ad362ee04
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Wed, 27 Dec 2023 13:20:13 -0700

frontend: make dll_export_fns=false on non-windows

Fixes a regression introduced in this branch.

Diffstat:
Msrc/Compilation/Config.zig | 6++++++
Msrc/main.zig | 5+++--
2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/Compilation/Config.zig b/src/Compilation/Config.zig @@ -138,6 +138,7 @@ pub const ResolveError = error{ LlvmLibraryUnavailable, LldUnavailable, ClangUnavailable, + DllExportFnsRequiresWindows, }; pub fn resolve(options: Options) ResolveError!Config { @@ -459,6 +460,11 @@ pub fn resolve(options: Options) ResolveError!Config { const rdynamic = options.rdynamic orelse false; const dll_export_fns = b: { + if (target.os.tag != .windows) { + if (options.dll_export_fns == true) + return error.DllExportFnsRequiresWindows; + break :b false; + } if (options.dll_export_fns) |x| break :b x; if (rdynamic) break :b true; break :b switch (options.output_mode) { diff --git a/src/main.zig b/src/main.zig @@ -3842,8 +3842,8 @@ fn createModule( create_module.opts.any_dyn_libs = true; create_module.resolved_options = Compilation.Config.resolve(create_module.opts) catch |err| switch (err) { - error.WasiExecModelRequiresWasi => fatal("execution model only allowed for WASI OS targets", .{}), - error.SharedMemoryIsWasmOnly => fatal("shared memory only allowed for WebAssembly CPU targets", .{}), + error.WasiExecModelRequiresWasi => fatal("only WASI OS targets support execution model", .{}), + error.SharedMemoryIsWasmOnly => fatal("only WebAssembly CPU targets support shared memory", .{}), error.ObjectFilesCannotShareMemory => fatal("object files cannot share memory", .{}), error.SharedMemoryRequiresAtomicsAndBulkMemory => fatal("shared memory requires atomics and bulk_memory CPU features", .{}), error.ThreadsRequireSharedMemory => fatal("threads require shared memory", .{}), @@ -3869,6 +3869,7 @@ fn createModule( error.LlvmLibraryUnavailable => fatal("zig was compiled without LLVM libraries", .{}), error.LldUnavailable => fatal("zig was compiled without LLD libraries", .{}), error.ClangUnavailable => fatal("zig was compiled without Clang libraries", .{}), + error.DllExportFnsRequiresWindows => fatal("only Windows OS targets support DLLs", .{}), }; }