Version 32 of TCL_LIBRARY

Updated 2008-10-08 16:54:18 by dgp

When the environment variable TCL_LIBRARY is defined, Tcl's default initialization sequence takes its value to be a file system directory in which the init.tcl file should be sought first. In a proper Tcl installation, use of this environment variable should not be needed. The main use for it is in Tcl's own build and test procedures to direct initialization of a freshly built Tcl program so that it can be tested before it is installed. Other than that, it should be considered a tool for "last-resort" workarounds of broken installations, not a tool for routine use.


If what you are trying to do is set an environment variable to point to directories containing other Tcl packages, check TCLLIBPATH.

Neither TCL_LIBRARY nor TCLLIBPATH are considered by tclkit, though.

DGP That claim surprises me. What is the evidence for it? - RS I tried, in a Cygwin bash,

 $ TCLLIBPATH=/usr/local/lib tclkitsh.exe

and expected its auto_path to be extended with /usr/local/lib, but it wasn't (neither with temporarily setting TCL_LIBRARY).

$ cat /tmp/t.tcl
#! /bin/tclsh

set ::env(TCLLIBPATH) /usr/tcl84/./lib/tcl8.4/
puts "TCLLIBPATH = $::env(TCLLIBPATH)"
puts "auto_path = $::auto_path"
$ export TCLLIBPATH=/usr/tcl84/./lib/tcl8.4/
$ tclkit /tmp/t.tcl
TCLLIBPATH = /usr/tcl84/./lib/tcl8.4/
auto_path = /usr/tcl84/bin/tclkit/lib/tcl8.4 /usr/tcl84/bin/tclkit/lib
$

LV I see similar behavior to the above using ActiveTcl's base-tcl8.5-thread-solaris-sparc-2.8

DGP What is the value of ::tcl_library in these situations? That should point us to which init.tcl file was evaluated, and the mystery would be why that init.tcl file did not do its usual things with the TCLLIBPATH environment variable.


See also magic names and tclvars.