Extension(3)

CLASS
tcl.lang.Extension -- The base class for building dynamically loadable Tcl extensions.

METHODS

void init(Interp interp)

void safeInit(Interp safeInterp)

static void loadOnDemand(Interp interp, String cmdName, String clsName)

ARGUMENTS
The interpreter in which the extension is to be loaded. The interpreter in which the extension is to be loaded safely. Name of the Tcl command to be loaded. The full pathname of the Java class to load as a Tcl command. The class should implement the Command interface.

DESCRIPTION
The Extension class is used to create dynamic Tcl extension, which can be loaded into a running Jacl interpreter with the java::load Tcl command

init
    A dynamic Tcl extension should override the init method to to perform initialization specific to the given extension. Usually, this means creating new commands inside the interpreter.

safeInit
    The safeInit method is similar to init, but it's used to perform initializations when the package is loaded into a safe interpreter. It should only enable features that are deemed "safe" to be executed by untrusted Tcl scripts.

    Note: safe interpreters are not currently implemented in Jacl and this function is currently only for future compatibility.

loadOnDemand
    The loadOnDemand method arranges a Command implementation class, specified by clsName, to be loaded into the JVM the first time the command cmdName is executed; this can reduce the time it takes to initialize an Extension. The class must implement either the Command interface or the CommandWithDispose interface.

SEE ALSO
Interp, Command, CommandWithDispose

KEYWORDS
loading, dynamic extension, safe interpreter