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.
develop
Pauli 2018-06-30 17:47:08 +03:00
parent 4d7008fbfa
commit 96c9b8b864
1 changed files with 1 additions and 2 deletions

@ -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);