Reputation: 21
The tcl interpreter converts the code to byte code at runtime, however it is not stored anywhere. Softwares like tclpro does it. Can anyone guide me on how to achieve this i.e. saving the tcl code in bytecode format for running it later, without using softwares like tclpro. Thanks !
Upvotes: 2
Views: 1655
Reputation: 137587
The simplest way of shipping bytecode around is as Tcl scripts. You know, the readable ones that you write. (The compiler is fast.)
Failing that, the only system for turning bytecode into a serialized form is part of the TclDevKit from ActiveState (which is a commercial product, and the successor to TclPro).
It's cost is quite reasonable if you're planning to ship a commercial product IIRC, and if it isn't a commercial product then why are you going to the effort to hide the source? The code to load bytecode back in from a file is slower than compiling a Tcl script de novo; the only reason for using the TDK compiler (and tbcload
, the bytecode loader) is for concealment.
If you really want to do this for packaging purposes, try using a tclkit. The tool for taking them apart, sdx, is freely available so it doesn't count as concealment so much as packaging.
Upvotes: 2