Subject: Tcl loadable packages
To: None <netbsd-help@netbsd.org>
From: David Bariod <david.bariod@wanadoo.fr>
List: netbsd-help
Date: 08/12/2005 08:01:35
     Hello all,

I have some issues with tcl related packages.
The current best practice within tcl is not
to build anymore various interpreters including all needed extension:
     - wish = Tcl + Tk
     - expect = Tcl + expect
     - itclsh = Tcl + Itcl
     - expectk = Tcl + Expect + Tk

This old mechanism may leed to manage gazillions of interpreters
related to all possible combination of Tcl binary extension.
What is recommended today is to always source the tcl program
with the tclsh interpreter and to dynamically load
the wanted binary (or pure tcl) package with
a "package require <package name command>" command.

It simplifies the handling of the tcl packages, you just manage
one given Tcl interpreter and the set of binary extension built
against this Tcl version.

Programmatically, it gives also more choices at the moment to load
the wanted package:
for example start or not a graphical Tk interface according to the command
line given to your application.

It seems that is not the way Tcl packages are built within netbsd packages.
I have the following errors from a tclsh session:

~ $ tclsh
% package require Tk
/usr/pkg/lib/libtk84.so: Undefined PLT symbol "XOpenDisplay" (symnum = 918)
~ $

~ $ tclsh
% package require Expect
couldn't load file "/usr/pkg/lib/tcl/expect5.43/../../libexpect543.la": /usr/pkg/lib/tcl/expect5.43/../../libexpect543.la: unrecognized file format
%

I have not yet installed the Itcl module, but I guess I won't be able
to dynamically load it either.

By the way, what it the use of the *.la file type.

I think the handling of Tcl packages should evolved to the more modern Tcl best practice.
What do you think ?

-----
David Bariod