Version 11 of How to compile a TCL script into an EXE program

Updated 2006-10-30 17:41:46

Robert Abitbol I have downloaded the great Tclkit.exe and I have often started tcl programs by copying them and pasting them into tclkit.exe (it's a great system I find!)

Now, how do I make a TCL program executable? Do I use Tclkit.exe?

Thanks!


How to compile a TCL script and an icons directory into an exe (in Windows)

This is how to compile a tcl script + an icons directory (or any other directory) into an exe program. Let's assume for the sake of the example that we have a script called Birds.tcl located in c:\Birds. Please copy the commands but don't forget to make the necessary adaptations. These instructions work for Windows.

1) Copy tclkit.exe and sdx.kit into the directory where your Tcl source code file is. Ex: in c:\Birds

 TCLKit.exe can be downloaded from: http://www.equi4.com/tkdownload.html
 Sdx.kit can be downloaded from:  http://www.equi4.com/pub/sk/

---> You will now have in c:\Birds the following files:

 * Birds.tcl
 * tclkit.exe
 * sdx.kit

2) Make a copy of the tclkit.exe into the directory where your TCL source code file is. Ex: in c:\Birds. Rename it to tclkit2.exe.

---> You will now have in c:\Birds the following files:

 * Birds.tcl
 * tclkit.exe
 * tclkit2.exe
 * sdx.kit

3) At Start/Run, type the following command (make the necessary adaptations):

 c:\Birds\tclkit sdx.kit qwrap birds.tcl

You will then get the TCL console. It will give a message: .. updates

Leave the console

4) At Start/Run again type the following command (make the necessary adaptations):

 c:\Birds\tclkit sdx.kit unwrap birds.kit

You will then get the TCL console. It will give a message: .. updates

Leave the console

5) At this stage, you have to copy the icons directory (or any other directory into:

c:\Birds\Birds.vfs\lib\app-Birds

(Make the necessary adaptations)

6) At Start/Run again type the following command (make the necessary adaptations):

 c:\Birds\tclkit sdx.kit wrap birds.exe -runtime tclkit2.exe

Leave the console.

---> Your exe is ready. Congratulations! Have fun! :)

Robert Abitbol Thanks FW for your great help!


For Apple and Unix users

 For Apple users: Do ... (instead of Start/Run)
 For Unix users: Do ... (instead of Start/Run)

Comments

"How can I compile Tcl type scripts into binary code" answers the question for many people. If you're starting from an appreciation of Tclkit, as apparently is the case, a Starpack might well be the most natural follow-up.

FW: Yep, the starpack page has the basic instructions.

FW: I helped him solve this off-wiki. I was gonna fix up his instructions as to how to make a starpack but I figured they would be out of place on this page, since they're the same as to make any Starkit. I won't be so brash as to delete them though.

Robert Abitbol Well just for fun, try to find instructions as clear as the ones above on this wiki. By the way: no need to complete them: I have done it. Thanks! I appreciate your excellent explanations!

aa - How to create my first Starpack seems somewhat more clear to me than the instructions above, and has the advantage of not being limited to Windows.

Robert Abitbol It works for you! Great then! Well it doesn't work for me and I am sure it doesn't work for a lot of people. To the contrary, FW's explanations works perfectly, A1! As the latins used to say: "de gustibus non disputandem" : we cannot discuss tastes; to each his own. I am sure explaining a different way to create an exe won't hurt anyone! :)

LV Robert, what do you mean when you say it doesn't work for me? Once specifics of a problem are reported, someone can hopefully make adjustments, clarifications, expansions appropriately.

Robert Abitbol Pages dealing with the very same subject-matter are way too complex for me from the start and I'm sure they are for many people also. So, instead of spending hours deciphering such pages, I thought I'd write a simpler procedure based on Alex FW's excellent instructions FW.


Look into Starpal

ZipGuy You might also like to look at the Starpal - TCL Development and Starkit generation which offers a few interesting features . :)


Adaptation of these procedures to Starpal

Robert Abitbol Oh! And if you decide to adapt the instructions above for Apple or Unix Operating systems, please be my guest. I did not do it since I run Windows.

You could write 2 lines of text. Something like:

 For Apple users: Do ... (instead of Start/Run)
 For Unix users: Do ... (instead of Start/Run)

Unix and Linux are not the same

LES Perhaps it should be noted that Unix is not the same as Linux. It is very easy to find support to all things Tcl in Linux, but not so easy in the BSD Unix family.


See also: http://www.equi4.com/papers/skpaper4_2.html