Version 14 of TCL_LIBRARY

Updated 2005-11-09 16:19:23

When the environment variable TCL_LIBRARY is defined, Tcl's default initialization sequence takes its value to be a filesystem 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.

The rest of this page has information about the TCLLIBPATH environment variable and its relation to the ::auto_path Tcl variable. What that information is doing on a page devoted to TCL_LIBRARY I have no idea. They aren't really closely related at all.


Hopefully someone can write a bit comparing and contrasting the use of this variable and TCLLIBPATH, and the Tcl variable $auto_path, describing to the developer when each should and should not be used, and to the user of Tcl applications just when each are safe or not safe to set.

Another useful thing to document here is what the format for the value should be. Is this a colon seperated series of directories, a space separated list of directories, or some kind of list of paths to pkgindex.tcl files, or just a single path?

See also magic names.


Usage of TCLLIBPATH versus auto_path

TCL uses auto_path to search the path for libraries on "package require" call. When it startsup, it updates auto_path using TCLLIBPATH and other info. See PkgIndex.tcl for more info.

Example Context

I use a hosting provider with virtual server. Default TCL libraries are in /usr/lib/tclxxx . I want to use libraries in tcllib.sourceforge.net. I can't install them under /usr/lib. I install them under /home/<myid>/tcllib. For testing, I set environment variable TCLLIBPATH before going into tclsh's interactive shell. So "package require xxx" is successful.

In CGI scripts , I need to do "package require ncgi" . I can't control the environment of CGI scripts. So I "lappend autopath <package path>" before doing "package require"


Category Tutorial