tcl_findLibrary

tcl_findLibrary is one of several commands documented at http://www.purl.org/tcl/home/man/tcl8.4/TclCmd/library.htm

Here's the basic information:

tcl_findLibrary basename version patch initScript enVarName varName

This is a standard search procedure for use by extensions during their initialization. They call this procedure to look for their script library in several standard directories. The last component of the name of the library directory is normally basenameversion (e.g., tk8.0), but it might be library when in the build hierarchies. The initScript file will be sourced into the interpreter once it is found. The directory in which this file is found is stored into the global variable varName. If this variable is already defined (e.g., by C code during application initialization) then no searching is done. Otherwise the search looks in these directories: the directory named by the environment variable enVarName; relative to the Tcl library directory; relative to the executable file in the standard installation bin or bin/arch directory; relative to the executable file in the current build tree; relative to the executable file in a parallel build tree.


Shouldn't $auto_path also be searched?

How should one use this routine in a case where one has the following installation?

 /location/where/TclIsInstalled
 /different/place/ExtensionIsInstalled

DGP [tcl_findLibrary] does not support unconventional installations like that. See Tcl Feature Request 695441 and Tk Bug 765642 for more information.

In this case, one checks the tcl_findLibrary call in the extension in question to see the enVarName which needs to be set to the additional directory.