From 4b2246ba9ff2f6ae97e48e9848548ef0e14aaba5 Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Sat, 3 Sep 2022 18:47:05 +0200 Subject: [PATCH 1/3] Fix #1999 Tested on Windows and Linux. --- src/llvm_backend.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp index 6ee1541d6..4a11fd4c3 100644 --- a/src/llvm_backend.cpp +++ b/src/llvm_backend.cpp @@ -1615,6 +1615,7 @@ void lb_generate_code(lbGenerator *gen) { } if (is_foreign) { LLVMSetLinkage(g.value, LLVMExternalLinkage); + LLVMSetDLLStorageClass(g.value, LLVMDLLImportStorageClass); LLVMSetExternallyInitialized(g.value, true); lb_add_foreign_library_path(m, e->Variable.foreign_library); From c94ca4c0cbd465c15130db45143d5e69e09b533f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20Sjo=CC=88berg?= Date: Sat, 3 Sep 2022 19:52:02 +0200 Subject: [PATCH 2/3] Use Megabyte constant In commit 698fcb7813dd391de76a5663ee64c48ce4f7d067, the size procedures were replaced with constants instead. --- tools/odinfmt/main.odin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/odinfmt/main.odin b/tools/odinfmt/main.odin index cebb20888..48e3b7212 100644 --- a/tools/odinfmt/main.odin +++ b/tools/odinfmt/main.odin @@ -70,7 +70,7 @@ walk_files :: proc(info: os.File_Info, in_err: os.Errno) -> (err: os.Errno, skip } main :: proc() { - init_global_temporary_allocator(mem.megabytes(100)); + init_global_temporary_allocator(mem.Megabyte * 100) args: Args; From f914fd0219fb4b6db642aae833e6b6db9f7718ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20Sjo=CC=88berg?= Date: Sat, 3 Sep 2022 20:03:02 +0200 Subject: [PATCH 3/3] maybe property does not exist anymore In commit 3ec70c5517062f3d35822253b2072df696b0c55f, the `#maybe` functionality was merged with the standard 'union' functionality, and thus, the `maybe` property was removed. --- tools/odinfmt/flag/flag.odin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/odinfmt/flag/flag.odin b/tools/odinfmt/flag/flag.odin index 33c0bfe12..6b2525717 100644 --- a/tools/odinfmt/flag/flag.odin +++ b/tools/odinfmt/flag/flag.odin @@ -146,7 +146,7 @@ reflect_args_structure :: proc(ctx: ^Flag_Context, v: any) -> Flag_Error { type := types[i]; if named_type, ok := type.variant.(Type_Info_Named); ok { - if union_type, ok := named_type.base.variant.(Type_Info_Union); ok && union_type.maybe && len(union_type.variants) == 1 { + if union_type, ok := named_type.base.variant.(Type_Info_Union); ok && len(union_type.variants) == 1 { flag.optional = true; flag.tag_ptr = rawptr(uintptr(union_type.tag_offset) + uintptr(v.data) + uintptr(offsets[i])); type = union_type.variants[0];