Instead expose a fake __imp_daylight in ucrtbase_compat.c which initially has the same value as (*__daylight()) from ucrtbase.dll, and after calling _tzset, redirect __imp_daylight to the ucrtbase.dll provided value.
Signed-off-by: Martin Storsjö <mar...@martin.st> --- mingw-w64-crt/crt/ucrtbase_compat.c | 3 +++ mingw-w64-headers/crt/time.h | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mingw-w64-crt/crt/ucrtbase_compat.c b/mingw-w64-crt/crt/ucrtbase_compat.c index f7e41e0..4c71d26 100644 --- a/mingw-w64-crt/crt/ucrtbase_compat.c +++ b/mingw-w64-crt/crt/ucrtbase_compat.c @@ -119,8 +119,10 @@ static char initial_tzname0[] = "PST"; static char initial_tzname1[] = "PDT"; static char *initial_tznames[] = { initial_tzname0, initial_tzname1 }; static long initial_timezone = 28800; +static int initial_daylight = 1; char** __MINGW_IMP_SYMBOL(tzname) = initial_tznames; long * __MINGW_IMP_SYMBOL(timezone) = &initial_timezone; +int * __MINGW_IMP_SYMBOL(daylight) = &initial_daylight; void __cdecl _tzset(void) { @@ -129,6 +131,7 @@ void __cdecl _tzset(void) // From this point, the exposed values should stay in sync. __MINGW_IMP_SYMBOL(tzname) = _tzname; __MINGW_IMP_SYMBOL(timezone) = __timezone(); + __MINGW_IMP_SYMBOL(daylight) = __daylight(); } void __cdecl tzset(void) diff --git a/mingw-w64-headers/crt/time.h b/mingw-w64-headers/crt/time.h index 886ec94..73f6264 100644 --- a/mingw-w64-headers/crt/time.h +++ b/mingw-w64-headers/crt/time.h @@ -272,12 +272,11 @@ __forceinline errno_t __cdecl ctime_s(char *_Buf,size_t _SizeInBytes,const time_ __MINGW_ATTRIB_DEPRECATED_MSG( \ "Only provided for source compatibility; this variable might " \ "not always be accurate when linking to ucrtbase.dll.") -#define daylight (_daylight) #else #define __MINGW_ATTRIB_DEPRECATED_UCRT - _CRTIMP extern int daylight; #endif + _CRTIMP extern int daylight __MINGW_ATTRIB_DEPRECATED_UCRT; _CRTIMP extern long timezone __MINGW_ATTRIB_DEPRECATED_UCRT; _CRTIMP extern char *tzname[2] __MINGW_ATTRIB_DEPRECATED_UCRT; void __cdecl tzset(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005; -- 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