From 96c9b8b8647f9355fb3a5c48edd30d18ffe413ec Mon Sep 17 00:00:00 2001 From: Pauli Date: Sat, 30 Jun 2018 17:47:08 +0300 Subject: [PATCH] Add windows emulation for RTLD_DEFAULT I'm not sure if calling GetModuleHandle in static construction is safe. But I assumme it is and works correctly. There is still potential issue that documentation can be understood meaning that the HMODULE will resolve only symbols from exe while RTLD_DEFAULT resolves all global symbols. --- library/PlugLoad-windows.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/library/PlugLoad-windows.cpp b/library/PlugLoad-windows.cpp index 61fe9977f..8d64e315c 100644 --- a/library/PlugLoad-windows.cpp +++ b/library/PlugLoad-windows.cpp @@ -41,8 +41,7 @@ distribution. */ namespace DFHack { - //! \todo What windows HMODULE matches RTLD_DEFAULT? - DFLibrary* GLOBAL_NAMES = 0; + DFLibrary* GLOBAL_NAMES = (DFLibrary*)GetModuleHandle(nullptr); DFLibrary * OpenPlugin (const char * filename) { return (DFLibrary *) LoadLibrary(filename);