Re: Error shutting down TCL

Mark Janssen schrieb:
One of the things Tcl_Finalize does is closing open channels
(including stdin and stdout) This means that after a call to
Tcl_Finalize these channels are not available anymore and therefore a
printf will fail.

Well, not exactly. In fact the Tcl IO subsystem does everything to
NOT accidentally close the stdio. But Tcl_Finalize() also calls
registered exit handlers of other Tcl extensions which may close open
file handles too.

As I stumbled upon this behavior myself: if you have Expect included,
it shoots down everything that looks like an open file handle,
including stdio.

The only one thing that reliably worked for me was to dup() the stdio
before Tcl_Finalize() and use the dup()ed file handles together with

kind regards
Matthias Kraft
Software AG, Germany