Tcl Source Code

View Ticket
Bounty program for improvements to Tcl and certain Tcl packages.
Ticket UUID: 1819422
Title: tclStubsPtr out of libtcl
Type: Patch Version: None
Submitter: dgp Created on: 2007-10-24 16:19:01
Subsystem: None Assigned To: dgp
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2008-04-03 04:41:32
Resolution: Accepted Closed By: dgp
    Closed on: 2008-04-01 16:33:23
Attached patch takes the
global C variable "tclStubsPtr"
out of the Tcl library, where
it arguably does not belong
in the first place.

"tclStubsPtr" is something
the Tcl stubs library needs, 
not the Tcl library.

Please review the patch.
User Comments: das added on 2008-04-03 04:41:32:
File Added - 272949: tk-stubs-modulescope.diff

Logged In: YES 
Originator: NO

MODULE_SCOPE patches committed to HEAD
File Added: tk-stubs-modulescope.diff

das added on 2008-04-03 04:40:38:
File Added - 272948: tcl-stubs-modulescope.diff

Logged In: YES 
Originator: NO

attached patches that
- make the symbols in libtclstub and libtkstub MODULE_SCOPE to avoid exporting them from extension shared libraries linked with the stub libs
- constify the *StubsPtr and stub table hook pointers
- fix USE_TCL_STUBS defines in tkStubLib.c and ttkStubLib.c
- remove now unnecessary unexporting of libtclstub symbols from libtk.
File Added: tcl-stubs-modulescope.diff

dgp added on 2008-04-01 23:33:23:
Logged In: YES 
Originator: YES

Committed for 8.6a0.

dgp added on 2007-10-24 23:49:25:
Logged In: YES 
Originator: YES

ah. there it is.

missed it since I searched
the Tcl tracker instead of Tk.

Got interested in the issue
again since I thought it might
be related to Bug 1792432.

Fine with me if these patches
sit for now, with intent to
re-examine/adopt early in 8.6

jenglish added on 2007-10-24 23:32:29:
Logged In: YES 
Originator: NO

See also discussion in #1716117.

I thought we decided to leave things as-is for 8.5?  (2007-05-16 11:35 comment).

Will look at the patch later.

dgp added on 2007-10-24 23:29:28:
File Added - 251166: 1819422.patch

Logged In: YES 
Originator: YES

One thing this patch breaks
is the building of a static wish:

/home/dgp/cvs/tk/unix/libtk8.5.a(tkStubLib.o): In function `Tk_InitStubs':
tkStubLib.c:(.text+0x16): undefined reference to `tclStubsPtr'
tkStubLib.c:(.text+0x111): undefined reference to `tclStubsPtr'
tkStubLib.c:(.text+0x14f): undefined reference to `tclStubsPtr'
collect2: ld returned 1 exit status

Closer examination shows that this is
because the static build configuration
for wish implies no USE_TCL_STUBS during
the compile, and a link against libtcl
instead of libtclstubs.  This conflicts
with the code for Tk_InitStubs() in
generic/tkStubLib.c where code in the
source file itself forces the enabling
of USE_TCL_STUBS.  Why?!  

The attached patch for Tk inherits the
genstubs changes, as well as dropping
the forced USE_TCL_STUBS from tkStubLib.c.
Applying this patch makes static wish
build just fine.

Perhaps an even better answer is
to iterate on this reform, and
get tkStubsPtr and Tk_InitStubs()
out of libtk.  I think that would
also solve the issue.

File Added: 1819422.patch

dgp added on 2007-10-24 23:19:01:
File Added - 251165: tclStubsPtr.patch