Distributing Bytecode Files
Compiled .tbc files execute a package require tbcload command. The tbcload package must be accessible via standard package loading mechanisms in order for the .tbc file to be interpreted successfully.
Because the protclsh83 and prowish83 interpreters include the tbcload package, tbcload is found automatically when the .tbc files are processed by these interpreters. There might be situations where you are unable to or do not want to use the prowish83 or protclsh83 interpreters, for example: if you are creating your own Tcl/Tk extensions, or if prowish83 or protclsh83 are too large to distribute to your customers.
The tbcload package is available as a shared library (such as a .dll on Windows and .so on Solaris) and as a static library. The shared library exports the two package initialization procedures: Tbcload_Init and Tbcload_SafeInit, which are required by the Tcl load command. You can use the shared library as you would any other Tcl package:
- Use pkg_mkIndex to create a package index file.
- Make sure that the shared library and index file are placed in a directory accessible to the package load mechanism.
If you follow the above guidelines, you can ship your bytecode files and the tbcload shared library to customers. See "Supported Versions" for information on compatible versions of Tcl/Tk, tbcload, and the bytecode files.
If you are building you own extensions, you can either use tbcload as a dynamically loaded Tcl package as described above, or you can add it to your application as a static package. In the latter case, your Tcl_AppInit procedure must contain the following code:
#include <proTbcLoad.h>
if (Tbcload_Init(interp) == TCL_ERROR) {
return TCL_ERROR;
}
Tcl_StaticPackage(interp, "tbcload", Tbcload_Init, Tbcload_SafeInit);
http://www.ajubasolutions.com Voice: (650) 210-0100 Fax: (650) 210-0101 support@ajubasolutions.com |