From f9299159657f3c19b59f37dd1de2d580dae51397 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 15 Jun 2022 10:04:41 +0000 Subject: Backport tclStubLib.c from Tcl 9.0 (they should be equal in 8.7 and 9.0) --- generic/tclStubLib.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c index 46d2f90..f06b2d1 100644 --- a/generic/tclStubLib.c +++ b/generic/tclStubLib.c @@ -17,11 +17,13 @@ MODULE_SCOPE const TclStubs *tclStubsPtr; MODULE_SCOPE const TclPlatStubs *tclPlatStubsPtr; MODULE_SCOPE const TclIntStubs *tclIntStubsPtr; MODULE_SCOPE const TclIntPlatStubs *tclIntPlatStubsPtr; +MODULE_SCOPE void *tclStubsHandle; const TclStubs *tclStubsPtr = NULL; const TclPlatStubs *tclPlatStubsPtr = NULL; const TclIntStubs *tclIntStubsPtr = NULL; const TclIntPlatStubs *tclIntPlatStubsPtr = NULL; +void *tclStubsHandle = NULL; /* * Use our own ISDIGIT to avoid linking to libc on windows @@ -56,10 +58,12 @@ Tcl_InitStubs( { Interp *iPtr = (Interp *)interp; const char *actualVersion = NULL; - ClientData pkgData = NULL; + void *pkgData = NULL; const TclStubs *stubsPtr = iPtr->stubTable; const char *tclName = (((exact&0xFF00) >= 0x900) ? "tcl" : "Tcl"); +#undef TCL_STUB_MAGIC /* We need the TCL_STUB_MAGIC from Tcl 8.x here */ +#define TCL_STUB_MAGIC ((int) 0xFCA3BACF) /* * We can't optimize this check by caching tclStubsPtr because that * prevents apps from being able to load/unload Tcl dynamically multiple @@ -106,6 +110,9 @@ Tcl_InitStubs( /* We are running Tcl 8.x */ stubsPtr = (TclStubs *)pkgData; } + if (tclStubsHandle == NULL) { + tclStubsHandle = INT2PTR(-1); + } tclStubsPtr = stubsPtr; if (stubsPtr->hooks) { -- cgit v0.12