Knowing the Starpack technology

As mentioned in the previous section, the starkit file has a small header containing the initialization script that executes the externally available tclkit. What would happen if we replaced this header with a binary code of Tclkit? In such cases, we would get a Starpack, a self-contained starkit, and a Tcl interpreter—all in one single file. This is the solution we are searching for in this chapter—a standalone executable file without any dependencies that does not require installation or configuration!

A Starpack file can be created in the standard way using the wrap command, but with the additional flag -runtime, which specifies what Tclkit binary should be put together with the starkit that is being produced. A typical usage is:

c:workspaceTclHelloWorld>tclkitsh-win32.upx.exe sdx.kit wrap hello.exe runtime tclkitsh-win32.upx.copy.exe
5 updates applied

Note that the Tclkit specified with -runtime must be different from the one actually executing this command, because a running Tclkit instance cannot copy itself. In this case we simply copied it, but here comes the beauty of this solution—you can use any Tclkit you want to, even for other platforms like Linux or Solaris. Therefore, you will be able to produce versions for different systems without even having access to them!

By default, when the output filename is of the form<app-name>.exe, or simply<app-name> in case of non-Windows platforms, SDX will search for the<app-name>.vfs directory holding the contents of your application.

After executing the hello.exe program, you will notice that it works in the same way as the .kit version:

c:workspaceTclHelloWorld>hello.exe
Hello World one more time!

The benefits of using Starpacks are:

  • The cleanest and the most elegant way of distribution and deployment—you deliver your entire application in the form of one file.
  • The installation is as simple as downloading / copying the file
  • Uninstalling the software is as simple as deleting the file
  • No dependency problems—all the required libraries are stored inside Starpack's VFS
  • Complete transparency and maturity—end users may not even be aware that the application is written in Tcl
  • The time required to wrap your application is extremely less once you know the rules

The limitations of using Starpacks are:

  • Starpack's size is larger than Starkit's, because the entire Tclkit interpreter is embedded inside it.
  • A Starpack file will work only on the platform that the instance of Tclkit used to create that starpack was compiled for.
  • Starpacks are incapable of modifying themselves, and the VFS structure is read only. If you really need to store some information, such as configuration information for your application, you will have to save it in some external file. We will address this issue in the next section called Advanced topics— self updating.
  • Due to the VFS limitation, some Tcl commands, such as exec to run programs inside VFS will not work correctly.
  • The practical Metakit database size limit is around 1 GB.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.134.198