NAME
extension - dynamically load extensions as shared libraries

SYNOPSIS

extension add name ?name...?

extension libs

extension lload library

extension linit initProc

DESCRIPTION

The extension command allows one to load extensions as shared libraries for Tcl.

COMMAND OPTIONS
The following options are available for the extension command:

extension add ?name?...
    Adds the extension name to the current process. Name. must be an entry in the global associative array tcl_extensions. If an entry for name doesn't exist or the variable tcl_extensions doesn't exist, an error message is returned. This command returns the empty string.

extension libs
    Lists the pathnames of the libraries currently loaded.

extension linit initProc
    Calls the C function initProc to initialize an extension. InitProc must be a valid entry point in a library that has already been loaded (see the lload option). This command returns the empty string.

extension lload library
    Loads the shared library library into the current process. If the library has already been loaded, it will not be loaded again. This command returns the empty string.

EXTENSIONS FILE
The first time the extension command is run it tries to source the file "[tcl library]/extensions.tcl". This file can be used to specify the extensions available and their respective libraries. You can always use the low-level commands to load a library too.

This file sets two global variables which the extension command uses to find shared libraries.

The first is an associative array tcl_extensions. This array maps an extension name (such as "blt") with the proper initialization routine and shared libraries. set tcl_extensions(blt) { Blt_Init libBLT.so.1.7 } The second variable is tcl_extloadpath. This variable is a list of directories to search for the library. set tcl_extloadpath {
    /usr/local/tcl/extensions/lib
    /usr/local/lib }

By default, the "extension" command looks for the file "[tcl library]/extensions.tcl". But you can override this by setting the environment variable TCL_EXTMAP. set env(TCL_EXTMAP) /u/mydir/my_extensions.tcl

SYSTEMS
The extension command has been tested on HP-UX, SunOS 4.x, and SunOS 5.x. It should work also on ISIX 5.x, OSF1.

KEYWORDS
extension