From 342be44f4da2cc09411fd0dc070ddcab26d87355 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 3 Jan 2013 10:17:14 +0000 Subject: don't use iPtr->legacyResult for Tcl >= 8.1, because it doesn't work. Use Tcl_AppendResult in stead. --- generic/tclStubLib.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c index fc07c26..fb9c132 100644 --- a/generic/tclStubLib.c +++ b/generic/tclStubLib.c @@ -108,8 +108,18 @@ TclInitStubs( * This is quicker to check for than calling Tcl_GetVersion() */ if (sizeof(size_t) != sizeof(int)) { if (stubsPtr->reserved77 != NULL) { - iPtr->legacyResult = "incompatible stub library: have 9, need 8"; - iPtr->legacyFreeProc = 0; /* TCL_STATIC */ + /* Accessing iPtr->legacyResult doesn't work here as Tcl 8 doesn't + * check this field after the Xxx_Init call. */ + char stripped[32]; /* Requested version stripped starting with '-' */ + char *p = stripped; + + while (*version && (*version != '-')) { + *p++ = *version++; + } + *p = '\0'; + stubsPtr->tcl_ResetResult(interp); + stubsPtr->tcl_AppendResult(interp, "incompatible stub library: have ", + tclversion, ", need ", stripped, NULL); return NULL; } } -- cgit v0.12