In a header file of your C/C++ application or extension that includes the Tk library, add these lines:
#include <tcl.h> ... #if (TK_MAJOR_VERSION < 8) #define Tk_SafeInit ((Tcl_PackageInitProc *) NULL) #endif
Why? Now your code can safely include the initialization sequence:
if (Tk_Init(interp) == TCL_ERROR) { return TCL_ERROR; } Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit);
without worrying about what versions of Tk do and do not define Tk_SafeInit().