Commit 791e83c223
Changed files (2)
src
Compilation
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) {
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", .{}),
};
}