libtclsh.a: A single file solution for embedding the Tcl Interpreter
Author: Clif Flynt
Several wrapping solutions have been presented to the community over the years. These include Jan Nijtman's original wrap program, TOBE, StarKits, ProWrap, and FreeWrap.
These solutions are ideal for a script developer who needs to distribute an executable version of his application with the Tcl interpreter wrapped around it.
They are not suited to providing a C/FORTRAN/ADA/Whatever developer with a single library to link with to gain access to the Tcl interpreter.
The libtclsh.a solution is to pack the contents of the tcl libraries into a memory structure, use a virtual file system to mount the memory image as a /mem directory into the Tcl interpreter and then redirect all the initialization to the /mem filesystem.
This initialization is similar to the approach used in Starkits, TOBE, etc, but reduces the level of external code required.
Using a C structure to hold Tcl files was used by the Borenstein/Rose SafeTcl interpreter. The pure ASCII representation of all the data in the Tcl initialization libraries is large (about 4 Meg), and leaves all the Tcl scripts (possibly including proprietry algorithms in the application) open to easy examination.
The libtclsh.a library maintains the memory image in a compressed format, reducing the memory footprint and restricting access to the Tcl scripts contents.
The paper will discuss the implementation and applications of this idea. Applications include providing FORTRAN developers a single library to link to for Network support and rapid-prototyping GUIs in Tcl for use by C++ developers.