From 5e06370a95c9f24bf23487913eeed04a4d6949ff Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin Date: Thu, 17 Jun 2021 22:31:25 +0500 Subject: [PATCH] Revert breaking changes. --- dlls/compile.bat | 2 +- dlls/h_export.cpp | 4 ++-- dlls/hl.def | 5 +++++ dlls/wscript | 11 +++++++++-- 4 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 dlls/hl.def diff --git a/dlls/compile.bat b/dlls/compile.bat index 0106f56d..f97806a5 100644 --- a/dlls/compile.bat +++ b/dlls/compile.bat @@ -113,7 +113,7 @@ set LIBS=user32.lib set OUTNAME=hl.dll set DEBUG=/debug -cl %DEFINES% %LIBS% %SOURCES% %INCLUDES% -o %OUTNAME% /link /dll /out:%OUTNAME% %DEBUG% +cl %DEFINES% %LIBS% %SOURCES% %INCLUDES% -o %OUTNAME% /link /dll /out:%OUTNAME% %DEBUG% /def:".\hl.def" echo -- Compile done. Cleaning... diff --git a/dlls/h_export.cpp b/dlls/h_export.cpp index 88353c7c..11884f9c 100644 --- a/dlls/h_export.cpp +++ b/dlls/h_export.cpp @@ -43,8 +43,8 @@ BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) return TRUE; } -// cdecl for win32 -#define EXPORT2 WINAPIV +// stdcall for win32 +#define EXPORT2 WINAPI #else #define EXPORT2 #endif diff --git a/dlls/hl.def b/dlls/hl.def new file mode 100644 index 00000000..c009191a --- /dev/null +++ b/dlls/hl.def @@ -0,0 +1,5 @@ +LIBRARY hl +EXPORTS + GiveFnptrsToDll @1 +SECTIONS + .data READ WRITE diff --git a/dlls/wscript b/dlls/wscript index 854bbb73..33d37185 100644 --- a/dlls/wscript +++ b/dlls/wscript @@ -10,8 +10,15 @@ def options(opt): return def configure(conf): - # stub - return + if conf.env.COMPILER_CC == 'msvc': + # hl.def removes MSVC function name decoration from GiveFnptrsToDll on Windows. + # Without this, the lookup for this function fails. + hlDefNode = conf.path.find_resource("./hl.def") + + if hlDefNode is not None: + conf.env.append_unique('LINKFLAGS', '/def:%s' % hlDefNode.abspath()) + else: + conf.fatal("Could not find hl.def") def build(bld): source = bld.path.parent.ant_glob([