TIP #66 Version 1.1: Stand-alone and Embedded Tcl/Tk Applications

This is not necessarily the current version of this TIP.


TIP:66
Title:Stand-alone and Embedded Tcl/Tk Applications
Version:$Revision: 1.1 $
Author:Arjen Markus <arjen dot markus at wldelft dot nl>
State:Draft
Type:Informative
Vote:Pending
Created:Tuesday, 02 October 2001
Keywords:installation, initialisation, embedded, resources

Abstract

This TIP describes the development and deployment of Tcl/Tk applications, with particular attention on how to embed the interpreter into executables written in C or C++.

Introduction and Background

Usually, an application that uses Tcl/Tk in some way uses an independent installation and the application itself is started via a standard shell, like tclsh or wish. There are numerous occasions when such a set-up is not convenient:

Another reason to document the resources used by Tcl/Tk is that this provides better insight in how to tune Tcl/Tk for a particular application.


Two examples may illustrate the need for such stand-alone applications and what is involved:

  1. When we were building an installation script for an MS Windows application using one of the commercial tools that are available for this arcane job, we ran into a bizarre limitation: text replacement was possible for the so-called Windows INI-files only, but not for other types of files. The text to be replaced was the name of the installation directory. After several trials with the programming constructs the tool allowed, we chose a much better solution: a small Tcl script wrapped into a stand-alone program using Freewrap. (The application itself now actually uses another stand-alone Tcl script to take care of the file management that was too complicated for ordinary DOS batch files.)

  2. The second example involves a small program that proves the usefulness of Tcl/Tk in on-line visualisation. The idea there is that large computational programs can send their data at regular steps during the computation to a separate program that plots these results in some meaningful way. To achieve this the program exports the results to the Tcl interpreter which uses the socket command to send them to a (primitive) viewer. For demonstration purposes you must be able to copy the program along with some files it needs on an arbitrary computer and, later, remove it with just a little effort.

Applications that use Tcl/Tk as an embedded library to achieve their goals, rather than exist as extensions or applications written in Tcl, can be quite useful. Examples include on-line visualisation in large computational programs, network applications that can be deployed as a single file etc. There is, however, little documentation on how to build such applications and what is required for their installation.


The aim of this TIP is to provide guidelines that make this development easier:

Related TIPs and Discussions

The are several TIPs at the moment of this writing that are in some way related to the subject:

Contents of the Planned Document

The document that should help programmers with the issues discussed here will have the following (tentative) table of contents:


Discussion

Issues that arise are:

This TIP is meant to be a document that enables programmers who do not have intimate knowledge of the Tcl core to build such application and deploy them in the way they want.

Should it turn out that some automated tool would be nice to help the programmers, then this TIP will also cover such a tool.

Copyright

This document is placed in the public domain.


Powered by TclThis is not necessarily the current version of this TIP.

TIP AutoGenerator - written by Donal K. Fellows