What are step by step instructions for compiling C++/Tk program into executable that would run on other users machines not requiring that end users to install any additional software, are there any entirely static link options for TCL tk?
What are step by step instructions for compiling C++/Tk program into executable that would
Share
Tcl and Tk work just fine when built statically; this is a supported (but not default) configuration. Just get the source releases and configure them with
--disable-sharedto ensure that they build the right type of library for you.Colin’s answer links to most of what you need to know about coding to use Tcl and Tk from inside your application, except you also need to call
Tcl_FindExecutablebefore you call any of those other programs (I’m assuming you’re not callingTcl_MainorTk_Main, which would do that for you but leave you bound to working liketclshandwishrespectively). That’s a necessary call to ensure that the Tcl library is internally configured correctly, as it handles initializing the encoding system and other low-level details like that.If you can structure your program like it works with tclsh or wish and just loading your C++ code as an extension package, I would urge you to build your code stubs-enabled and then package it all as a starkit/starpack. In particular, a starpack is a single-file executable which is effectively a self-contained binary distribution of Tcl and Tk plus your application code in a compressed archive format. It’s really rather nice to distribute apps this way as it avoids putting code where users can inadvertently break it, but it’s not suitable for everything. (There are related solutions that can include encrypting your code too, but they’re commercial-only.)