@@ -101,10 +101,16 @@ # endif /* _WIN32_WCE */ # endif /* KITSH_NEED_WINMAIN */ int main(int argc, char **argv); # endif /* HAVE_ACCEPTABLE_DLADDR */ #endif /* !TCLKIT_DLL */ + +#ifdef TCLKIT_DLL +void __attribute__((constructor)) _Tclkit_Init(void); +#else +static void _Tclkit_Init(void); +#endif #ifdef TCLKIT_REQUIRE_TCLEXECUTABLENAME char *tclExecutableName; #endif @@ -141,15 +147,13 @@ "catch { load {} zlib }\n" #endif #ifdef KIT_INCLUDES_MK4TCL "catch { load {} Mk4tcl }\n" #endif -#ifdef TCLKIT_DLL "load {} tclkit::init\n" "::tclkit::init::initInterp\n" "rename ::tclkit::init::initInterp {}\n" -#endif /* TCLKIT_DLL */ "set bootfile [file join " TCLKIT_MOUNTPOINT " boot.tcl]\n" "if {[file exists $bootfile]} {\n" "catch {\n" "set f [open $bootfile]\n" "set s [read $f]\n" @@ -395,10 +399,11 @@ * in LibraryPathObjCmd because this information is needed both * before and after that command is run. */ FindAndSetExecName(interp); #if defined(_WIN32) && defined(KIT_INCLUDES_TK) + /* Every interpreter needs this done */ Tk_InitConsoleChannels(interp); #endif /* _WIN32 and KIT_INCLUDES_TK */ return; } @@ -412,13 +417,11 @@ # endif /* !_WIN32_WCE */ # endif /* _WIN32 */ #endif /* KIT_INCLUDES_TK */ /* Perform common initialization */ - _Tclkit_Generic_Init(); - - _Tclkit_Interp_Init(interp); + _Tclkit_Init(); if (Tcl_Init(interp) == TCL_ERROR) { goto error; } @@ -516,10 +519,13 @@ } #endif /* _WIN32 */ return(NULL); } +#else +# define find_tclkit_dll_path() NULL +#endif /* * This function exists to allow C code to initialize a particular * interpreter. */ @@ -560,13 +566,16 @@ /* * Initialize the Tcl system when we are loaded, that way Tcl functions * are ready to be used when invoked. */ +#ifdef TCLKIT_DLL void __attribute__((constructor)) _Tclkit_Init(void) { +#else +static void _Tclkit_Init(void) { +#endif Tcl_StaticPackage(0, "tclkit::init", Tclkit_init_Init, NULL); _Tclkit_Generic_Init(); return; } -#endif