Plus patches

references since August 3, 1997
New files available:
tcl8.0p2plus.patch.gz (updated: 12/23/97)
A patch for Tcl8.0p2, which adds more support for Shared libraries and Standalone applications. See below.
tk8.0p2plus.patch.gz (updated: 12/23/97)
A patch for Tk8.0p2, which adds more support for Shared libraries and Standalone applications. See below.
tcl8.0p2plus.tar.gz (updated: 12/23/97)
Complete distribution of Tcl8.0p2+ (with plus-patch already applied) (updated: 12/23/97)
The same as tcl8.0p2plus.tar.gz, only in a different format.
tk8.0p2plus.tar.gz (updated: 12/1/97)
Complete distribution of Tk8.0p2+ (with plus-patch, dash-patch, img-patch and elide.patch already applied) (updated: 12/23/97)
The same as tk8.0p2plus.tar.gz, only in a different format.
Further on the following files are available:

Patch utility for UNIX.
Patch utility for Windows. (hopefully it works)
Older files, no longer supported:
itcl2.2plus.patch.gz (updated: 3/17/97)
A patch for Itcl2.2, which adds more support for Shared libraries and Standalone applications. See below.
tcl7.6p2plus.patch.gz (updated: 4/29/97)
A patch for Tcl7.6p2, which adds more support for Shared libraries and Standalone applications. See below.
tcl7.6p2plus.tar.gz (updated: 4/29/97)
Complete distribution of Tcl7.6p2+ (with above patch already applied)
tk4.2p2plus.patch.gz (updated: 4/29/97)
A patch for Tk4.2p2, which adds more support for Shared libraries and Standalone applications. See below.
tk4.2p2plus.tar.gz (updated: 4/29/97)
Complete distribution of Tk4.2p2+ (with above patch and dash-patch already applied)
tclX7.6.0plus.patch.gz (updated: 3/18/97)
A patch for TclX7.6.0, which adds more support for Shared libraries and Standalone applications. See below. Requires either Itcl 2.2 or Tcl7.6(p2)/Tk4.2(p2) with the corresponding plus-patches.
No longer supported.
No longer supported.

About the "Plus"-patches

These patches currently are supported only for Tcl8.0p2/Tk8.0p2 and Tcl7.6p2/Tk4.2p2. They contains serveral enhancements (which are summarized below) and a few small bug fixes. The most changes are in the configure script and the Makefile, but also some minimal changes are made in the code. All changes are 100% upwards compatible with the corresponding offical Tcl/Tk releases.

TkCon console

Jeffrey Hobbs' TkCon console (version 1.1) is now the standard console. If this console cannot be initialized for some reason, or if stdin/stdout is no tty, the default console (stdin/stdout) will start up. Another way to disable this console is add the line "set NoTkCon 1" to your .tclshrc file.

Shared library support

If the option "--enable-shared" is given to the configure script both the static and shared libraries are created. Also in all directories where shared libraries are a pkgIndex.tcl file is created which contains references to all functions in these shared libraries.

Standalone Applications

In addition to Tcl_Init() and Tk_Init (or Xxx_Init in general) there are now additional functions Tcl_InitStandAlone() and Tk_InitStandAlone() (or Xxx_InitStandAlone in general). These perform the same function, only the Tcl and Tk libraries are compiled into the executable. This makes the executable larger, of course, but they will run on any system no matter if Tcl/Tk (or blt or Tix) is installed or not. Included is a program tcl2c, which translates tcl scripts into C source code. Compiling this code and linking with the necessary static libraries (it doesn't work with shared libraries) results in a standalone executable.

For example:

This compiles your script into C-code (with support for Tk and TclX). Compiling this code with the static libraries will produce the standalone executable.

Event Loop (not fully functional yet in 8.0 and 8.0p1)

Tclsh is now fully event-driven. That means that after the script is finished the application will start an event-loop which is compatible with the Tk event-loop. The application will end as soon as there are no active event handlers any more. By default, all event handlers will be passive, except the console and the X11 handler. So, if there is no console and no X11-handler the application will still end immediately. As a result, this is fully upwards compatible with the official Tcl/Tk distributions

This is implemented by defining the flag TCL_ACTIVE, which is from the same type as TCL_READABLE, TCL_WRITEABLE and TCL_EXCEPTION. If this flag is used in the Tcl_CreateFileHandler() or Tcl_CreateChannelHandler() functions, this is a request to the application to continue handling events as long as these event handlers are active. There is also a new option active to the fileevent command. This option is equivalent to readable, only the application will not exit as long as the file is not closed. For example:

	set f [open "test.tcl" r]
	fconfigure $f -blocking 0
	fileevent $f active {
	    set num [gets $f line]
	    puts stdout "$num: \"$line\""
	    if {[eof $f]} {
		close $f


Now the following files are changed such that they now can be compiled by any C or C++ compiler (both K&R and ANSI).


Loadable extensions

If loading is enabled, the executables tcltest and tktest are no longer created for testing purposes. In stead, loadable libraries,,, and are created which only contain the additional test functions. These loadable libraries will be used to test tclsh and wish.


Additional make-options are added:
make tclsh
Shared version of tclsh (default)
make tclsh++
C++ version of tclsh
make tclsh.static
Static version of tclsh
make tclsh.standalone
Standalone version of tclsh
make test
Execute tests using tclsh and
make test++
Execute tests using tclsh++ and
make test.static
Execute tests using tclsh.static and
make test.standalone
Execute tests using tclsh.standalone and
make hello.c
Create C source code from "hello.tcl"
make hello
Create executable from "hello.tcl"
make hello++
Create executable from "hello.tcl" (using C++ compiler)
The same options are available for Tk too.

Additionally, you can now run make in a sub-directory of tcl8.0/ or tk8.0/.

Written by:Updated: December 23, 1997
Jan Nijtmans
CMG (Computer Management Group) Arnhem B.V.
email: (private) (work)