Browse Source

Add hinstdll forward to runtime globals

Jeroen van Rijn 1 year ago
parent
commit
c49afb0039
2 changed files with 4 additions and 1 deletions
  1. 2 0
      base/runtime/core.odin
  2. 2 1
      base/runtime/entry_windows.odin

+ 2 - 0
base/runtime/core.odin

@@ -299,6 +299,8 @@ when ODIN_OS == .Windows {
 		Thread_Detach  = 3,
 		Thread_Detach  = 3,
 	}
 	}
 	dll_forward_reason: DLL_Forward_Reason
 	dll_forward_reason: DLL_Forward_Reason
+
+	dll_instance: rawptr
 }
 }
 
 
 // IMPORTANT NOTE(bill): Must be in this order (as the compiler relies upon it)
 // IMPORTANT NOTE(bill): Must be in this order (as the compiler relies upon it)

+ 2 - 1
base/runtime/entry_windows.odin

@@ -10,8 +10,9 @@ when ODIN_BUILD_MODE == .Dynamic {
 	DllMain :: proc "system" (hinstDLL: rawptr, fdwReason: u32, lpReserved: rawptr) -> b32 {
 	DllMain :: proc "system" (hinstDLL: rawptr, fdwReason: u32, lpReserved: rawptr) -> b32 {
 		context = default_context()
 		context = default_context()
 
 
-		// Populate Windows DLL-specific global
+		// Populate Windows DLL-specific globals
 		dll_forward_reason = DLL_Forward_Reason(fdwReason)
 		dll_forward_reason = DLL_Forward_Reason(fdwReason)
+		dll_instance       = hinstDLL
 
 
 		switch dll_forward_reason {
 		switch dll_forward_reason {
 		case .Process_Attach:
 		case .Process_Attach: