We can't redirect these to the function calls via defines, since "#define timezone" will break any code that uses e.g. "struct timezone".
We can provide a replacement data member here, but it is only updated on init. Alternatively, we could just skip providing these when building with ucrtbase, but that would require updating any calling code. Signed-off-by: Martin Storsjö <mar...@martin.st> --- mingw-w64-crt/crt/ucrtbase_compat.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mingw-w64-crt/crt/ucrtbase_compat.c b/mingw-w64-crt/crt/ucrtbase_compat.c index ca872de..ce21d26 100644 --- a/mingw-w64-crt/crt/ucrtbase_compat.c +++ b/mingw-w64-crt/crt/ucrtbase_compat.c @@ -24,6 +24,7 @@ #include <internal.h> #include <sect_attribs.h> #include <stdio.h> +#include <time.h> #undef vfprintf #undef fprintf @@ -142,6 +143,13 @@ int * __MINGW_IMP_SYMBOL(_fmode) = &local_fmode; char ** __MINGW_IMP_SYMBOL(_acmdln); char ** __MINGW_IMP_SYMBOL(_wcmdln); +// These are required to provide the unrepfixed data symbols "timezone" +// and "tzname"; we can't remap "timezone" via a define due to clashes +// with e.g. "struct timezone". We set these on startup, but they won't +// track changes during runtime. +char** __MINGW_IMP_SYMBOL(tzname); +static int local_timezone; +int * __MINGW_IMP_SYMBOL(timezone) = &local_timezone; // The parts below are mostly ugly workarounds, necessary to appease code @@ -161,6 +169,9 @@ static void __cdecl init_compat_dtor(void) InitializeCriticalSection(&exit_lock); atexit(free_locks); + + __MINGW_IMP_SYMBOL(tzname) = _tzname; + local_timezone = _timezone; } _CRTALLOC(".CRT$XID") _PVFV mingw_ucrtbase_compat_init = init_compat_dtor; -- 2.7.4 ------------------------------------------------------------------------------ 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