Tcl Source Code

Check-in [062ca741cb]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:On-hold at Don Porter's request. change stub library to detect - and generate a nice error-message - when a shared library compiled for Tcl 8.x is attempted to be loaded in Tcl 9.x: Tcl 9 will not have the iPtr->result field so we cannot use that any more.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | on-hold-84
Files: files | file ages | folders
SHA1: 062ca741cb1d9fb42b105edae53c6c6471a5f608
User & Date: jan.nijtmans 2012-11-18 16:54:16
Original Comment: change stub library to detect - and generate a nice error-message - when a shared library compiled for Tcl 8.x is attempted to be loaded in Tcl 9.x: Tcl 9 will not have the iPtr->result field so we cannot use that any more.
Context
2012-11-18
17:04
On hold at Don Porter's request hange stub library to detect - and generate a nice error-mes... Closed-Leaf check-in: 9c960be0cb user: jan.nijtmans tags: on-hold-85
16:54
On-hold at Don Porter's request. change stub library to detect - and generate a nice error-m... Closed-Leaf check-in: 062ca741cb user: jan.nijtmans tags: on-hold-84
2012-11-16
10:16
Fix msgcat.test (in case a higher msgcat version is encountered, which is not included with Tcl 8.4)... check-in: feb6e6bc81 user: jan.nijtmans tags: core-8-4-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclStubLib.c.

33
34
35
36
37
38
39




40
41
42
43
44
45
46
47

48
49
50


51





52








53


54
55
56
57
58
59
60

TclStubs *tclStubsPtr = NULL;
TclPlatStubs *tclPlatStubsPtr = NULL;
TclIntStubs *tclIntStubsPtr = NULL;
TclIntPlatStubs *tclIntPlatStubsPtr = NULL;

static TclStubs *	HasStubSupport _ANSI_ARGS_((Tcl_Interp *interp));





static TclStubs *
HasStubSupport (interp)
    Tcl_Interp *interp;
{
    Interp *iPtr = (Interp *) interp;

    if (iPtr->stubTable && (iPtr->stubTable->magic == TCL_STUB_MAGIC)) {

	return iPtr->stubTable;
    }
    interp->result = "This interpreter does not support stubs-enabled extensions.";


    interp->freeProc = TCL_STATIC;














    return NULL;


}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_InitStubs --
 *







>
>
>
>







|
>
|

<
>
>
|
>
>
>
>
>
|
>
>
>
>
>
>
>
>
|
>
>







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81

TclStubs *tclStubsPtr = NULL;
TclPlatStubs *tclPlatStubsPtr = NULL;
TclIntStubs *tclIntStubsPtr = NULL;
TclIntPlatStubs *tclIntPlatStubsPtr = NULL;

static TclStubs *	HasStubSupport _ANSI_ARGS_((Tcl_Interp *interp));

typedef Tcl_Obj *(NewStringObjProc) _ANSI_ARGS_((CONST char *bytes,
				size_t length));


static TclStubs *
HasStubSupport (interp)
    Tcl_Interp *interp;
{
    Interp *iPtr = (Interp *) interp;

    if (!iPtr->stubTable) {
	/* No stub table at all? Nothing we can do. */
	return NULL;
    }

    if (iPtr->stubTable->magic != TCL_STUB_MAGIC) {
	/*
	 * We cannot acces interp->result and interp->freeProc
	 * any more: They will be gone in Tcl 9. In stead,
	 * assume that the iPtr->stubTable entry from Tcl_Interp
	 * and the Tcl_NewStringObj() and Tcl_SetObjResult() entries
	 * in the stub table don't change in Tcl 9. Need to add
	 * a test-case in Tcl 9 to assure that.
	 * 
	 * The signature of Tcl_NewStringObj will change: the length
	 * parameter will be of type size_t. But passing the value
	 * (size_t)-1 will work, whatever the signature will be.
	 */
	NewStringObjProc *newStringObj = (NewStringObjProc *)
		iPtr->stubTable->tcl_NewStringObj;
	iPtr->stubTable->tcl_SetObjResult(interp, newStringObj(
		"This extension is compiled for Tcl 8.x", (size_t)-1));
	return NULL;
    }
    return iPtr->stubTable;
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_InitStubs --
 *