Tcl_GetChannelHandle() forward compatibility

In a header file of your C/C++ application or extension that includes the Tk library, add these lines:

  #include <tcl.h>
  extern int Tcl_GetChannelHandle _ANSI_ARGS_((Tcl_Channel, int, ClientData*));

Somewhere in your program/library code, add these lines:

  Tcl_GetChannelHandle(Tcl_Channel channel, int dir, ClientData *handlePtr)
      Tcl_File tfile=Tcl_GetChannelFile(channel,dir);
      if(tfile==NULL) return TCL_ERROR;
      return TCL_OK;

There! Now you can call Tcl_GetChannelHandle() even if you happen to link against a Tcl 7 library.