The public Tk function, Tk_InitConsoleChannels()
has no documentation.
When the documentation is written, it should make
it clear that Tk_InitConsoleChannels() must be called
early in a program -- before any Tcl_Channel operations
have a chance to take place.
Otherwise, the failure of Tk_InitConsoleChannels()
to Tcl_RegisterChannel() the console channels
-- it can't, it has no interp to work with --
and the lack of auto-registration of the Tcl
standard channels to make up for it -- because the
previous Tcl_Channel operations already initialized
the Tcl standard channels to the system defaults --
will cause nasty errors like
"can not find channel named "stderr""
See attached demo.c for explanation of how to
properly use Tcl_SetStdChannel, and why
Tk_InitConsoleChannels() can't do that, so must
be called early instead.