From f43dd68346925f9c2ab0b55fe60e1cec2526d9dc Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 11 Oct 2021 13:54:06 +0000 Subject: Better solution, in stead of [https://core.tcl-lang.org/tk/info/6ffcea9b093deb5a|6ffcea9b]: Handle 64-bit (Cygwin64) Tcl_GetTime(), when loading tk86.dll --- generic/tcl.h | 3 +++ generic/tclDecls.h | 15 ++++++++++++++- tests/proc.test | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 2dc3ae2..827dc0a 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -1420,6 +1420,9 @@ typedef enum { typedef struct Tcl_Time { long sec; /* Seconds. */ long usec; /* Microseconds. */ +#if defined(_WIN32) && defined(_WIN64) + __int64 reserved; /* Not used, except for win64 <-> Cygwin64 interoperability. */ +#endif } Tcl_Time; typedef void (Tcl_SetTimerProc) (CONST86 Tcl_Time *timePtr); diff --git a/generic/tclDecls.h b/generic/tclDecls.h index f250634..26d1cd6 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -3948,7 +3948,20 @@ extern const TclStubs *tclStubsPtr; #define Tcl_UpVar(interp, frameName, varName, localName, flags) \ Tcl_UpVar2(interp, frameName, varName, NULL, localName, flags) -#if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) +#if defined(USE_TCL_STUBS) +# if defined(_WIN32) && defined(_WIN64) +# undef Tcl_GetTime +/* Handle Win64 tk.dll being loaded in Cygwin64. */ +# define Tcl_GetTime(t) \ + do { \ + Tcl_Time *_timePtr = (t); \ + _timePtr->reserved = -1; \ + tclStubsPtr->tcl_GetTime((_timePtr)); \ + if (_timePtr->reserved != -1) { \ + _timePtr->usec = _timePtr->reserved; \ + } \ + } while (0) +# endif # if defined(__CYGWIN__) && defined(TCL_WIDE_INT_IS_LONG) /* On Cygwin64, long is 64-bit while on Win64 long is 32-bit. Therefore * we have to make sure that all stub entries on Cygwin64 follow the diff --git a/tests/proc.test b/tests/proc.test index a6409c8..f453bea 100644 --- a/tests/proc.test +++ b/tests/proc.test @@ -332,7 +332,7 @@ test proc-4.10 { } } -cleanup { catch {rename p1 {}} -} -result 0 +} -result 0 test proc-5.1 {Bytecompiling noop; test for correct argument substitution} -body { proc p args {} ; # this will be bytecompiled into t -- cgit v0.12