Skip to content

Using Critcl

zdia edited this page Dec 10, 2010 · 9 revisions

Example: Creating a shared library f32 for the Twofish algorithm

The C code for the extension is in the file f32-critcl.tcl


Download the critcl files:


tclkit-executable-name critcl2.kit -lib f32-critcl.tcl


$ tclkit critcl2.kit -lib f32-critcl
Target:   ix86-linux
Source:   f32-critcl.tcl 

We rename the library to:

Cross compiling a Windows library:

Xmingw offers cross compiling on a Unix host. So we install it and inform Critcl about the cross-compile environment, e.g.:

export PATH="~/mingw32/i386-mingw32/bin:$PATH"


tclkit critcl2.kit -lib f32-critcl.tcl 

will not recognize the mingw compiler.

But critcl.kit works:

$ tclkit critcl.kit -lib f32-critcl
Cross compiling for Windows using Xmingwin
Source: f32-critcl.tcl 
Library: f32-critcl.dll

The library will be renamed to:



We have to work on a Mac. We need three files from our Linux host:

  • tclkit-darwin-univ-aqua
  • critcl.kit
  • f32-critcl.tcl

Then we can create the Mac version:

$ ./tclkit-darwin-univ-aqua critcl.kit -lib f32-critcl.tcl 
Source: f32-critcl.tcl 
Library: f32-critcl.dylib

which will be renamed to:


Something went wrong with that request. Please try again.