On Fri, 17 Nov 2017, Jacek Caban wrote:

On 17.11.2017 18:45, Martin Storsjö wrote:
On Fri, 17 Nov 2017, Jacek Caban wrote:

On 17.11.2017 10:12, Martin Storsjö wrote:
+  HANDLE ucrt;
+
+  ucrt = GetModuleHandle("ucrtbase.dll");
+  real__tzset = (void __cdecl (*)(void)) GetProcAddress(ucrt,
"_tzset");


Can we get away without GetModuleHandle()/GetProcAddress()? For example:
keep _tzset in .def file and call it using __MINGW_IMP_SYMBOL in the
hook?

That should also work, provided that we remove _CRTIMP from the
declaration in the headers. There are a few cases of similar patterns
with GetProcAddress around though,

GetProcAddress is often needed for msvcrt.dll, because we can't depend
on function being available in all versions. That's not a case for
ucrtbase, so I'd leave this for linker.

but I don't mind removing the _CRTIMP, assumimg all other .def files
have _tzset without the __imp prefix as well.

Unless I'm missing something, it might be easier to add #ifdef with crt
version around _CRTIMP for _tzset.

Right - yes, that sounds good.

// Martin
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to