erichui
erichui

Reputation: 2771

Interfacing zlib with ActiveTcl 8.5?

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.

Upvotes: 1

Views: 1268

Answers (3)

Donal Fellows
Donal Fellows

Reputation: 137567

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.

Upvotes: 1

Reputation:

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

Upvotes: 1

Jackson
Jackson

Reputation: 5657

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

Upvotes: 2

Related Questions