Re: Dynamic loading of the scotty 2.1.0 extension

Juergen Schoenwaelder (schoenw@cs.utwente.nl)
Thu, 13 Jun 1996 20:18:47 +0200

Graeme McKerrell <graemem@pdd.3com.com> wrote:

> if the scotty package has been set up to auto load using the
> pkg_mkIndex procedure found in "init.tcl"of the TCL7.5 distribution,
> "package require scotty" correctly reports the version of the module
> and sets up the autoloading scripts BUT when one of the new commands
> is executed it fails to load the module.

There are reasons for not using pkg_mkIndex. I need to load the
package when the package require command is evaluated (because the
Tnm_Init() function does more things than registering commands).
Delayed loading as supported by pkg_mkIndex does not work. For
example, the tnm global array won't exist before you execute the first
command of the tnm package.

> The reason for this is because the "load $WHERE_EVER/tnm.a scotty"
> command loads in the module then tries to call the Scotty_Init
> C-Function, which doesn't exist!! There should be a consitancy
> between the package name registered with the Tcl_PkgProvide call and
> the registered initialisation function. i.e Tnm_Init should be
> called Scotty_Init if we are going to register a package name of
> "scotty" changing this C-function to this name solves the problem.

No, tnm is the official name of the package now and if there is an
inconsistency, than it is probably the package name scotty. Note, this
is only important if you use pkg_mkIndex which does not work (see
above).

> This now means that there is NO NEED to have a separate "scotty"
> executable as all the fucntionality can be acheived from within a
> standard "tclsh" or "wish" (I haven't tried a "wish" yet) shell.

No. tclsh is not event driven, scotty is. If in future Tcl version
tclsh becomes completely event driven, we can drop the scotty binary.
Thats why I changed the command line interface - this will make this
transition easier. Note also that the need for the scotty binary is
unrelated to the way you load packages. Note also that I dropped
scwish because you can use a plain wish now.

The reason for having the pkg_mkIndex.tcl file in the tnm2.1.0
directory is to make sure that no one needs to touch them. Why are you
running pkg_mkIndex to create new pkg_mkIndex files? Are there
any good reasons I did not care about?
Juergen