Updated 2013-09-19 01:02:34 by RLE

In a header file of your C/C++ application or extension that includes the Tk library, add these lines:
  #include <tcl.h>
  ...
  #if (TCL_MAJOR_VERSION < 8)
  extern int Tcl_GetChannelHandle _ANSI_ARGS_((Tcl_Channel, int, ClientData*));
  #endif

Somewhere in your program/library code, add these lines:
  #if (TCL_MAJOR_VERSION < 8)
  int
  Tcl_GetChannelHandle(Tcl_Channel channel, int dir, ClientData *handlePtr)
  {
      Tcl_File tfile=Tcl_GetChannelFile(channel,dir);
      if(tfile==NULL) return TCL_ERROR;
      *handlePtr=Tcl_GetFileInfo(tfile,NULL);
      return TCL_OK;
  }
  #endif

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