• Richard W.M. Jones's avatar
    Add Tcl plugin, for writing plugins in Tcl. · c4e75c52
    Richard W.M. Jones authored
    This lets you write simple plugins in Tcl.  All the basic features of
    nbdkit are supported, but serious Tcl users will probably want to
    enhance the plugin further.
    Unfortunately Tcl as a language is not very well suited to handling
    binary data.  It prefers to store binary data in UCS-2 strings,
    meaning that every second byte is wasted.  Also there appears to be no
    way to replace part of such a string/array in-place.
    Strictly speaking Tcl requires that:
       "only the thread that created a Tcl interpreter can use that
       interpreter. In other words, multiple threads can not access the
       same Tcl interpreter."
    Apparently this applies even if nbdkit uses mutexes to ensure that
    multiple threads are not calling into the interpreter at the same
    time.  We do not have such a threading model in nbdkit (see also VDDK)
    but at the same time I was not able to get Tcl to crash.
    The Tcl interpreter leaks quite a lot of memory from the tcl_load and
    tcl_open calls.  This may be connected with the previous point.  It
    makes valgrind fairly useless so it is disabled for Tcl.