summaryrefslogtreecommitdiffstats
path: root/generic/tclStubLibTbl.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclStubLibTbl.c')
-rw-r--r--generic/tclStubLibTbl.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/generic/tclStubLibTbl.c b/generic/tclStubLibTbl.c
index 0391502..ad34494 100644
--- a/generic/tclStubLibTbl.c
+++ b/generic/tclStubLibTbl.c
@@ -13,6 +13,8 @@
#include "tclInt.h"
+MODULE_SCOPE void *tclStubsHandle;
+
/*
*----------------------------------------------------------------------
*
@@ -32,18 +34,26 @@
MODULE_SCOPE const char *
TclInitStubTable(
const char *version) /* points to the version field of a
- TclStubInfoType structure variable. */
+ structure variable. */
{
- tclStubsPtr = ((const TclStubInfoType *) version)->stubs;
+ if (version) {
+ if (tclStubsHandle == NULL) {
+ /* This can only happen with -DBUILD_STATIC, so simulate
+ * that the loading of Tcl succeeded, although we didn't
+ * actually load it dynamically */
+ tclStubsHandle = (void *)1;
+ }
+ tclStubsPtr = ((const TclStubs **) version)[-1];
- if (tclStubsPtr->hooks) {
- tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs;
- tclIntStubsPtr = tclStubsPtr->hooks->tclIntStubs;
- tclIntPlatStubsPtr = tclStubsPtr->hooks->tclIntPlatStubs;
- } else {
- tclPlatStubsPtr = NULL;
- tclIntStubsPtr = NULL;
- tclIntPlatStubsPtr = NULL;
+ if (tclStubsPtr->hooks) {
+ tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs;
+ tclIntStubsPtr = tclStubsPtr->hooks->tclIntStubs;
+ tclIntPlatStubsPtr = tclStubsPtr->hooks->tclIntPlatStubs;
+ } else {
+ tclPlatStubsPtr = NULL;
+ tclIntStubsPtr = NULL;
+ tclIntPlatStubsPtr = NULL;
+ }
}
return version;