Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2010-07-25
17:42 • Closed ticket [3029891fff]: Functions that don't belong in the stub table</i... artifact: f6d826668c user: nijtmans
2010-07-17
05:08 • Ticket [3029891fff]: 4 changes artifact: 98998a5990 user: nijtmans
2010-07-15
09:44 • New ticket [3029891fff]. artifact: fffbbf8e97 user: nijtmans

Functions that don't belong in the stub table

Closed / Fixed3029891fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 16 years ago
Descriptionplain2010-07-15 09:44:48
As follow-up of #1055668, it's clear that Tcl_Main
does not belong in the stub table, but there are
more like that:
In Tcl, the following functions are only meant to be used
in tclAppInit.c, and are problematic when compiled with
USE_TCL_STUBS:  Tcl_FindExecutable and
Tcl_StaticPackage

In Tk: Tk_MainEx, Tk_Init, Tk_SafeInit and
Tk_CreateConsoleWindow

Then there are 3 functions in Tcl that can be
used from tclAppInit.c, and are used through
the stub table as well: Tcl_CreateInterp,
Tcl_Init and Tcl_SetVar. Currently there is
no other way than #undef TCL_USE_STUBS
in xxxAppInit.c, but I suggest to redefine the
stub macros a little bit as below. This way,
we can use (Tcl_CreateInterp)() when we
don't want to use stubs and Tcl_CreateInterp()
otherwise. Apart from that, everything functions
as before.

Best would be to remove the said functions
from the stub table, but less dangerous is just
disable the stub usage. That can be done by
putting the following at the end of tclDecls.h:

#undef Tcl_CreateInterp
#undef Tcl_FindExecutable
#undef Tcl_Init
#undef Tcl_SetVar
#undef Tcl_StaticPackage
#if defined(USE_TCL_STUBS)
#   define Tcl_CreateInterp() (tclStubsPtr->tcl_CreateInterp())
#   define Tcl_Init(interp) (tclStubsPtr->tcl_Init(interp))
#   define Tcl_SetVar(interp, varName, newValue, flags) \
(tclStubsPtr->tcl_SetVar(interp, varName, newValue, flags))
#endif

At the end of tkDecls.h:
#undef Tk_MainEx
#undef Tk_Init
#undef Tk_SafeInit
#undef Tk_CreateConsoleWindow
nijtmansplain2010-07-17 05:08:31
Tk part fixed in HEAD
nijtmansplain2010-07-25 17:42:43
allow_comments - 1

Fixed in HEAD
Log in (anonymous is fine) to add a comment.