From c49afb0039a1527fbe42505af73000fcc7e3ad08 Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Wed, 10 Jul 2024 19:58:29 +0200 Subject: [PATCH] Add hinstdll forward to runtime globals --- base/runtime/core.odin | 2 ++ base/runtime/entry_windows.odin | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/base/runtime/core.odin b/base/runtime/core.odin index 550daed3b..a758a2fdd 100644 --- a/base/runtime/core.odin +++ b/base/runtime/core.odin @@ -299,6 +299,8 @@ when ODIN_OS == .Windows { Thread_Detach = 3, } dll_forward_reason: DLL_Forward_Reason + + dll_instance: rawptr } // IMPORTANT NOTE(bill): Must be in this order (as the compiler relies upon it) diff --git a/base/runtime/entry_windows.odin b/base/runtime/entry_windows.odin index 7020e9ea8..1e2dcc21a 100644 --- a/base/runtime/entry_windows.odin +++ b/base/runtime/entry_windows.odin @@ -10,8 +10,9 @@ when ODIN_BUILD_MODE == .Dynamic { DllMain :: proc "system" (hinstDLL: rawptr, fdwReason: u32, lpReserved: rawptr) -> b32 { context = default_context() - // Populate Windows DLL-specific global + // Populate Windows DLL-specific globals dll_forward_reason = DLL_Forward_Reason(fdwReason) + dll_instance = hinstDLL switch dll_forward_reason { case .Process_Attach: