Skip to content
Tcl Source Code Artifact [c5da0f1911]
Login

Artifact [c5da0f1911]

Artifact c5da0f1911b2df9a53740fcda24b774e62a50b50:

Wiki page [Main] by dgp on 2014-10-09 19:21:32.
D 2014-10-09T19:21:32.585
L Main
P 00f4862eaf0875c42ed7dcec2a2988a3c59bc378
U dgp
W 2829
<h1>Source Files</h1>
  *  [/finfo?name=generic/tclMain.c|tclMain.c]
  *  [/finfo?name=unix/tclAppInit.c|tclAppInit.c]
  *  [/finfo?name=win/tclAppInit.c|tclAppInit.c]

<h1>Public Interface</h1>
  *  Tcl_SetStartupScript
  *  Tcl_GetStartupScript
  *  Tcl_SourceRCFile
  *  Tcl_Main
  *  Tcl_MainEx
  *  Tcl_SetMainLoop

<h1>Private Interface</h1>
  *  TclFullFinalizationRequested
  *  TclGetMainLoop

<h1>Directly Depends On Public Interface</h1>
  *  [Threads]
  *  [Object System and Fundamental Object Types]
  *  [Variable Commands and Interfaces]
  *  [Pathname Management]
  *  [Filesystem Access]
  *  [Channel System]
  *  [list Object Type]
  *  [Preservation]
  *  [Parsing and Evaluation]
  *  [interp]
  *  [(Initi/Fin)alize]
  *  [dict Object Type]
  *  [Linked C Variables]
  *  [history]
  *  <i>unistd.h</i>

<h1>Directly Depends On Private Interface of</h1>
  *  [Initialization, Library, Autoloader]
  *  [Pathname Management]
  *  [Object System and Fundamental Object Types]
  *  [Parsing and Evaluation]
  *  [Allocation]
  *  [Environment Variables]
 
<h1>Discussion</h1>

The routine <b>TclGetMainLoop</b> appears in no header file.
It gets declared with <b>MODULE_SCOPE</b> but there doesn't appear to be any reason
it could not be a static function.

The routine <b>TclFullFinalizationRequested</b> probably should move into [(Initi/Fin)alize].

<h2>The core_zip_vfs Patch</h2>
The [/timeline?r=core_zip_vfs|core_zip_vfs] branch adds the ability to mount a zip archive concatenated to the current executable as a virtual file system, capable of hosting both env(TCL_LIBRARY) and kick off
a bootloader (if a file called <i>main.tcl</i> is present).

This patch:
  *  Adds  [/finfo?name=generic/tclZipVfs.c|tclZipVfs.c]
  *  Modifies [/finfo?name=unix/tclAppInit.c|tclAppInit.c]
  *  Modifies [/finfo?name=win/tclAppInit.c|tclAppInit.c]

To build a self-contained executable:
<verbatim>
cp tclsh mynewkit
# Build an empty zipfile and concat it to the executable
touch .empty
zip null.zip .empty
cat null.zip >> mynewkit
#
echo "puts {hello world}" > main.tcl
# The -A argument tells zip to offset itself from the executable
zip -A mynewkit main.tcl
./mynewkit
hello world
(Program exit)
</verbatim>

For convenience the tcl Makefile has a "make tclkit", which make a tclkit with
an embedded TCL_LIBRARY.

The tk Makefile has a "make tkkit" which provides a similar service for wish-based kits.

If the shells are compiled with --enable-shared=no, the Tcl/Tk libraries will be statically
bound with the shells, and thus truly self-contained. Otherwise they will need access to the 
tcl/tk shared libraries. Either in the same directory as the executable, or tucked somewhere in your operating's systems library search path.
Z 6015f85b8f3ce4e942bca86eac6528ae