mktclapp

D. Richard Hipp's "utility [1 ] that helps you mix C/C++ with Tcl/Tk to make a standalone executable."

 What: Mktclapp
 Where: http://www.hwaci.com/sw/mktclapp/  
        http://home.sprynet.com/%7Eetailor/et/stuff/howto_tcl.txt  (Not Working as of 2005-10-31)
        http://home.sprynet.com/%7Eetailor/et/stuff/test_tutorial.zip  (Not Working as of 2005-10-31)
        http://www.poSoft.de/  
 Description: Tool (that replaces ET) that lets you mix C (or C++) with Tcl/Tk.
        The newest version provides support for the Tcl_Obj interface.
        Also includes the ability to 'hide' code via a shroud option.
        The executable is a single binary file that runs without Tcl/Tk
        being installed.  Source code can compile, without change on
        either Unix or Windows 98/NT.  Currently at version 3.8.
        The sprynet site is a tutorial and sample file showing how
        E Taylor combined mktclapp, vtcl and Microsoft Visual C/C++
        to create an application.
        The posoft site has a patch of mktclapp 3.9 to help with
         building on Windows with Visual C++.
 Updated: 06/2002
 Contact: mailto:[email protected]  (D. Richard Hipp)

Is this related to TOBE? LV In a sense - TOBE is the successor to this package.

[someone else] HOWEVER, note that, despite what CL occasionally claims, there remains a place for mktclapp, even in a TOBE-endowed world. As DRH wrote in April 2006, "If want a convenient mechanism for writing C functions that are accessible from TCL, then mktclapp might well be a better option. . . . Using mktclapp, if you have a C function of the form "ET_COMMAND_abcdefg(){...}" then it will automatically get linked in as a TCL command "abcdefg". No need for calls to Tcl_CreateObjCommand(). This can be very convenient if you are writing a lot of C functions that you want to be accessible from TCL."


IDG It also gives you a convenient framework for building C extensions as .dll/.so's


[point to other "compilers"]


"DrumFire" reports that he has been able to use mktclapp to build .so-s from .tcl-s, for the purpose of obfuscation of the plain-text .tcl source. This was his recipe:

    mktclapp -notk -standalone -main-script function.tcl \
            -extension function function.tcl > function.c
    gcc -shared -o function.so function.c etc etc etc

The result is a loadable function.so.

2004-04-28 SRIV Neat, but look at the function.so in a hex editor. Not very obfuscated if you ask me. Or, better yet. load function.so; info body function :)


A previous generation of this tool was called:

 What: Embedded Tk (ET)
 Where: http://www.hwaci.com/sw/et/ET.html  
        http://www.hwaci.com/sw/et/et80b6.tar.gz  
 Description: Code preprocessor and library which simplifies the task of
        developing applications which use both C and Tcl/Tk.
        Version 1.7 is the latest version and works with Tk 4.2 or newer.
        Uses the GNU autoconf system.  Works with Win95 and Unix.
        Comes with some sample applications (such as a terminal emulator),
        and a 30 page article describing ET.
        Version 8.0b5 works with Tk 4.x and 8.x.
        Versions compiled under Windows need tcl80.dll, tk80.dll
        and cw3210.dll and any other dynamic library you want to load
        into the program.
        This system is no longer being developed.  The author has a new
        system, known as mktclapp , that users should turn to.
 Updated: 07/1998
 Contact: mailto:[email protected]  (D. Richard Hipp)

MkTclApp hints


Disadvantages of mktclapp, compared to Starpack:

  • directives are redundant. To add a new .tcl source file into an application requires touching the corresponding makemake.tcl.in, and ...
  • C boilerplate. There's a proliferation of sources.
  • The Tcl source for a mktclapp application cannot be sourced "standalone" during development nearly as conveniently.
  • Can mktclapp include, in its vfs, loadable extensions? CL isn't sure, but doubts it.
  • Minor: [compressed tclkit ...]

Two remarks above already touched on mktclapp's VFS. Here's a different approach to the same subject: this VFS is designed for textual sources, and application-specific C-compiled objects. It appears unlikely that more general binary content--including foreign executables--can effectively be embedded, EXCEPT by (base64-)encoding them into a textual format (but how does "shrouding" work?). Robert Sciuk of Control-Q might have worked in this area. CL still hasn't convinced himself that loadable objects either can, or cannot, be embedded.


In August 2009 on comp.lang.tcl, a thread discussing the fact that an attempt to use mktclapp generated C code to build a simple hello, world application failed to link due to the fact that the interfaces that mktclapp expects to use are no longer available as of Tcl 8.5. There doesn't appear to be an update available on the application web site to handle this situation.