Check-in [be67e6913f]
Overview
Comment:Updated to use single routine for initializing interpreters
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tk-win32-noconsole-fix
Files: files | file ages | folders
SHA1:be67e6913f53dc726aa8e174772098979db2ca05
User & Date: rkeene on 2014-02-25 02:59:35
Other Links: manifest | tags
Context
2014-03-03
21:58
Merged console fixes in check-in: 4ae3806806 user: rkeene tags: trunk
2014-02-25
02:59
Updated to use single routine for initializing interpreters Closed-Leaf check-in: be67e6913f user: rkeene tags: tk-win32-noconsole-fix
2014-02-24
17:22
Added start of test for Tk on Win32 with noconsole check-in: 9481ffeac5 user: rkeene tags: tk-win32-noconsole-fix
Changes

Modified kitsh/buildsrc/kitsh-0.0/kitInit.c from [35c2f17362] to [8905d676cc].

    99     99   #      else
   100    100   int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow);
   101    101   #      endif /* _WIN32_WCE */
   102    102   #    endif /* KITSH_NEED_WINMAIN */
   103    103   int main(int argc, char **argv);
   104    104   #  endif /* HAVE_ACCEPTABLE_DLADDR */
   105    105   #endif /* !TCLKIT_DLL */
          106  +
          107  +#ifdef TCLKIT_DLL
          108  +void __attribute__((constructor)) _Tclkit_Init(void);
          109  +#else
          110  +static void _Tclkit_Init(void);
          111  +#endif
   106    112   
   107    113   #ifdef TCLKIT_REQUIRE_TCLEXECUTABLENAME
   108    114   char *tclExecutableName;
   109    115   #endif
   110    116   
   111    117   /*
   112    118    *  Attempt to load a "boot.tcl" entry from the embedded MetaKit file.
................................................................................
   139    145   	"catch { load {} vfs }\n"
   140    146   #ifdef KIT_INCLUDES_ZLIB
   141    147   	"catch { load {} zlib }\n"
   142    148   #endif
   143    149   #ifdef KIT_INCLUDES_MK4TCL
   144    150   	"catch { load {} Mk4tcl }\n"
   145    151   #endif
   146         -#ifdef TCLKIT_DLL
   147    152   	"load {} tclkit::init\n"
   148    153   	"::tclkit::init::initInterp\n"
   149    154   	"rename ::tclkit::init::initInterp {}\n"
   150         -#endif /* TCLKIT_DLL */
   151    155   	"set bootfile [file join " TCLKIT_MOUNTPOINT " boot.tcl]\n"
   152    156   	"if {[file exists $bootfile]} {\n"
   153    157   		"catch {\n"
   154    158   			"set f [open $bootfile]\n"
   155    159   			"set s [read $f]\n"
   156    160   			"close $f\n"
   157    161   		"}\n"
................................................................................
   393    397   
   394    398   	/* Hack to get around Tcl bug 1224888.  This must be run here and
   395    399   	 * in LibraryPathObjCmd because this information is needed both
   396    400   	 * before and after that command is run. */
   397    401   	FindAndSetExecName(interp);
   398    402   
   399    403   #if defined(_WIN32) && defined(KIT_INCLUDES_TK)
          404  +	/* Every interpreter needs this done */
   400    405   	Tk_InitConsoleChannels(interp);
   401    406   #endif /* _WIN32 and KIT_INCLUDES_TK */
   402    407   
   403    408   	return;
   404    409   }
   405    410   
   406    411   #ifndef TCLKIT_DLL
................................................................................
   410    415   #    ifndef _WIN32_WCE
   411    416   	char msgBuf[2049];
   412    417   #    endif /* !_WIN32_WCE */
   413    418   #  endif /* _WIN32 */
   414    419   #endif /* KIT_INCLUDES_TK */
   415    420   
   416    421   	/* Perform common initialization */
   417         -	_Tclkit_Generic_Init();
   418         -
   419         -	_Tclkit_Interp_Init(interp);
          422  +	_Tclkit_Init();
   420    423   
   421    424   	if (Tcl_Init(interp) == TCL_ERROR) {
   422    425   		goto error;
   423    426   	}
   424    427   
   425    428   #ifdef KIT_INCLUDES_TK
   426    429   #  ifdef _WIN32
................................................................................
   514    517   	if (gmfn_ret != 0) {
   515    518   		return(strdup(modulename));
   516    519   	}
   517    520   #endif /* _WIN32 */
   518    521   
   519    522   	return(NULL);
   520    523   }
          524  +#else
          525  +# define find_tclkit_dll_path() NULL
          526  +#endif
   521    527   
   522    528   /*
   523    529    * This function exists to allow C code to initialize a particular
   524    530    * interpreter.
   525    531    */
   526    532   static int tclkit_init_initinterp(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
   527    533   	char *kitdll_path;
................................................................................
   558    564   	return(tclPkgProv_ret);
   559    565   }
   560    566   
   561    567   /*
   562    568    * Initialize the Tcl system when we are loaded, that way Tcl functions
   563    569    * are ready to be used when invoked.
   564    570    */
          571  +#ifdef TCLKIT_DLL
   565    572   void __attribute__((constructor)) _Tclkit_Init(void) {
          573  +#else
          574  +static void _Tclkit_Init(void) {
          575  +#endif
   566    576   	Tcl_StaticPackage(0, "tclkit::init", Tclkit_init_Init, NULL);
   567    577   
   568    578   	_Tclkit_Generic_Init();
   569    579   
   570    580   	return;
   571    581   }
   572         -#endif