Tcl Dynamic Loader

"tcldl" package can dynamically load a "Tcl module" and executes
"boot" function to create new Tcl commands. "tcldl" can also destroy
"Tcl module" loaded and executes "exit" function to delete Tcl commands.
In most of time, the "Tcl module" means a shared library. See TclDL.doc
for the details.

Module "dltest" is a simple dynamic loadable Tcl module.
Module "itcl" is a dynamic loadable version of [incr] Tcl. 
The "exit" function of module "itcl" can not free all memory,
so it results some memory leak. 

Version 0.3 supports linux, Sun OS 4.1.x, Solaris 2.x, Dec OSF/1 and IRIX 5.x.
It is beta stage now. Bugs report and improvement suggestions are welcome.


<<NEW>>

	1) supports Solaris 2.x, Dec OSF/1 and IRIX 5.x now.
	2) there are scripts for freebsd/netbsd but 
	   I don't test them.
	3) configure.in supports multi-platform compile
	4) add initial script in Dl_Init();
	5) change interface definition of functions, Dl_DestroyModule and
	   Dl_ExecModule. It is compatible with version 0.2 in user level. 


<<FTP SITE>>

ftp.aud.alcatel.com [198.64.191.10] /pub/tcl/extensions

URL: http://130.209.12.75:8001
This server only runs in off peek time (GMT 17:00-9:00).


<<MANIFEST>>

README		-- this file
TclDL.doc	-- dynamic loader interface specification
Makefile.in	-- 
configure.in
config.guess
config.sub
install-sh	
configure	-- automatic configure files
dl_tcl.h	-- dynamic loader include file
dl_init.c	-- dynamic loader initial C file
dl_use.tcl	-- Tcl source of dynamic loader
dl_dld.c	-- interface implementation using dld library (linux)
dl_dlopen.c	-- interface implementation using dlopen library 
		   (sunos4, solaris2, OSF/1, IRIX5, freebsd)
dl_misc.c	-- miscellaneous functions.
tclAppInit.c	-- tcl application initial file
dltest.c	-- simple dynamic loadable module C part
dltest.tcl	-- simple dynamic loadable module Tcl part
itcl.c		-- itcl-1.5 dynamic loadable module C part
itcl.tcl	-- itcl-1.5 dynamic loadable module Tcl part
linux		-- linux box configure directory
sunos4		-- sunos 4 configure directory
solaris2	-- solaris 2 configure directory
osf1		-- Dec OSF/1 configure directory
irix5		-- SGI IRIX 5 configure directory
freebsd		-- Free BSD configure directory
	dltest_default -- dltest module platform dependent configure
	itcl_default   -- itcl module platform dependent configure


<<PLATFORM>>

I tested version 0.3 in
 
        i486/DX-2/66, linux 1.1.59, gcc 2.5.8, Tcl4.0b2
	Sun Sparc10, SunOS 4.1.3, K&R cc, Tcl4.0b2
	Sun Sparc1000, Solaris 2.3, SunPro C 3.0.1
	SGI Indy, IRIX 5.2, SGI cc
	Dec Alpha, OSF/1 1.3, cc


<<INSTALL>>

	0. for linux box, you need install dld-3.2.5.bin.tar.gz 
	   from sunsite.unc: Linux/libs
	1. get tcl and itcl source. Compile and install them.
	   You need install shared itcl library except in linux.
	2. gzip -dc tcldl0.2.tgz | tar xvf -
	3. build Tcl dynamic loader 
	   If you don't want install all stuff into /usr/local, 
	   you need use --prefix to set new directory, for example,
 	      ./configure --prefix=${HOME}
	   install all stuff into your HOME directory. 

	   The default use cc compile, you can override it 
	   with option --with-gcc or --with-acc.

	   The default use -O, you can override it with 
	   option --with-debug.

	   ./configure; make; make install


<<TEST>>
	
	1. In order to use dynamic loader, you must set the environment
	   variable DL_LIBRARY to point all dynamic loadable module and
	   external symbol libray such as libc.a, libtcl.a, and libitcl.a

	   for example, when you install Tcl, itcl in you HOME directory,
	   you can set DL_LIBRARY as (use bash)
		export DL_LIBRARY=~/lib:/usr/local/lib:/usr/lib:/lib
	
	2. bin/tclsh		<== run the tcl with Dynamic Loader

	3. dltest_do		<== try the command "dltest_do"
	4. dl_use dltest	<== dynamic load module "dltest"
	5. dltest_do		<== try the command "dltest_do"
	6. dl_destroy dltest	<== dynamic destroy module "dltest"
	7. dltest_do		<== try the command "dltest_do"
	8. dl_use dltest	<== dynamic load module "dltest" again

	9. dl_use itcl		<== dynamic load module "itcl"
	10. info commands itcl* <== itcl relative commands
	11. dl_destroy itcl	<== dynamic destroy module "itcl"
	12. info commands itcl* <== itcl relative commands
	13. dl_use itcl		<== dynamic load module "itcl" again
	14. cd ../../itcl-1.5/tests
	15. source all		<== run itcl's test script


<<AUTHOR>>

Dr Xiaokun Zhu
E-mail:  xiaokun@aero.gla.ac.uk

	+--------------------------------------------------------+
	| WELCOME TO BUG REPORTS AND SUGGESTIONS FOR IMPROVEMENT |
	+--------------------------------------------------------+

<<COPYRIGHT>>

Copyright (C) 1995 Xiaokun Zhu
tcldl package is free software; you can redistribute it and/or 
modify it under the terms of the GNU General Public License.


<<HISTORY>>

Version 0.2

	1) change all interface specification of verion 0.1 ;-)
	2) discard C interface functions: 
		dl_load_file, dl_undef_symbols, dl_find_symbol
	3) interface function of Tcl dynamic loader calls system library
	   (dld, dlopen, etc) directly. 
	4) implement the interface of dynamic destroy module.
	5) support dlopen library (sunos 4)
	6) support multi-platform configure (linux, sunos4)

Version 0.1

The interface of Tcl Dynamic Loader (0.1) based on perl5.000's DynaLoader 
interface definition.

Perl5's Dynaloader interface based on the work and comments of 
(in no particular order): Larry Wall, Robert Sanders, Dean Roehrich, 
Jeff Okamoto, Anno Siegel, Thomas Neumann, Paul Marquess, Charles Bailey, 
Tim Bunce,  and others.
