Tclkit

From Rosetta Code
Tclkit is an implementation of Tcl. Other implementations of Tcl.

tclkit and tclkitsh are single-file distributions of Tcl (based on libtcl) that can be launched without prior installation; they store all auxiliary files in an internal filesystem-in-a-database. The main difference between tclkit and tclkitsh is on Windows, where the former is built as a graphical application (so not using real stdio) and the latter as a console application (forcing the opening of a console window if run from Explorer); these differences are a feature of the Windows platform. (The difference between java and javaw for Java runtimes is analogous.)

Tools are available for simply building user applications into single file distributions based on tclkit, through concatenating a further filesystem-database file. Since this technique is orthogonal (and largely transparent) to the application, it has become a very popular technique for distributing applications implemented in Tcl.

Building an Application with Tclkit

Note that unlike the source for this material, this quick tutorial assumes that you already have things installed.

Write your application

Save this into a file hello.tcl: <lang tcl>package require Tk pack [button .b -text "Hello World!" -command bell]</lang>

Wrap your application

At the shell command line, type this: <lang bash>SDX="tclkit sdx.kit" $(SDX) qwrap hello.tcl</lang>

Test your application

<lang bash>tclkit hello.kit</lang>

Unwrap and rewrap with the full runtime attached

<lang bash>$(SDX) unwrap hello.kit</lang> That creates a directory, hello.vfs, that contains the packaged application. This is when you would copy into there any libraries – either pure scripted or compiled from some other language, e.g., C – that you wanted to distribute with your application. Then you rewrap it into a full, self-contained executable like this: <lang bash>$(SDX) wrap hello -vfs hello.vfs -runtime `which tclkit`</lang>

See Also