views:

115

answers:

3

I'm trying to use the zlib extension in ActiveTcl 8.5 in order to save out a compressed blob to a file. Both ActiveTcl 8.5.5 and 8.5.6 on win32 have a zlibtcl 1.2.3 extension. I've tried both:

package require zlibtcl

and

load zlibtcl123.dll

Which both seem to indicate that the extension is properly loaded. However, I can't seem to figure out what command is necessary to access the extension. I am aware that ActiveTcl 8.6b1 onwards has the zlib functionality built in (http://wiki.tcl.tk/4610), however I need to deploy to existing systems that must use 8.5.x.

As far as I can tell, loading the extension does not add any new commands to the interpreter, which is quite confusing. Running a strings on the dll does not seem to reveal any additional information.

Note: my backup plan is to SWIG zlib, but I'd prefer to use the existing extension if possible.

A: 

You might have more luck with the vfs::zip package. There is an example on comp.lang.tcl here.

Jackson
Good thought. I just tried this and vfs::zip does not appear to be part of the default ActiveTcl 8.5.5 install... and I kind of need a solution for this runtime environment.
erichui
It's certainly part of the 8.4 ActiveTcl install. I think that they really slimmed down the number of default packages that came with 8.5 - if you want to restrict yourself to the basic 8.5 install you are going to struggle. It's easily downloadable for 8.5 using teacup.
Jackson
A: 

zlibtcl is used only by the Img package to handle the compression in image formats like PNG. As suggested above, try vfs::zip. The Trf package is also worthwhile looking into. See http://wiki.tcl.tk/479

A: 

You can get a copy of the zlib package from equi4, who provide it as part of their support for the tclkit Tcl interpreter/packaging system. It doesn't support the full interface used in 8.6, but it does have enough that you can compression and decompression.

Or you can just use tclkit instead of tclsh/wish and have the zlib package already built in.

Donal Fellows