Tcl_Init(3)
β¨ Tcl_Init β¨
okay bestie, welcome to the Tcl_Init(3) page from the Tcl Library Procedures π this is the one that goes and finds your initialization script and sources it, like a little scout that fetches the vibe before the party starts π¦
πΈ NAME πΈ
Tcl_Init β find and source initialization script π
π SYNOPSIS π
#include <tcl.h>
int
Tcl_Init(interp)
const char *
Tcl_SetPreInitScript(scriptPtr)
π ARGUMENTS π
Tcl_Interp *interp(in) β the interpreter you wanna initialize, bestie π«Άconst char *scriptPtr(in) β the address of the initialization script π
β¨ DESCRIPTION β¨
So Tcl_Init is literally a helper procedure that goes and finds the init.tcl script and sources it. That script should exist somewhere on the Tcl library path β no cap π₯
Tcl_Init is typically called from Tcl_AppInit procedures. iykyk π
π§ Tcl_SetPreInitScript π§
Tcl_SetPreInitScript registers the pre-initialization script, and it returns the former script pointer β the one that just got replaced, like it's handing you the old fit back π
You can pass a value of NULL if you don't wanna register any script at all, no pressure πΈ
The pre-initialization script gets executed by Tcl_Init before accessing the file system β οΈ The whole point of it is typically to prepare a custom file system (like an embedded zip-file, iconic) so it gets activated before the search even happens π«
okay so important one: when you're using this in stub-enabled embedders, the stubs table has to be initialized first, using one ofTcl_InitSubsystems,Tcl_SetPanicProc,Tcl_FindExecutableorTclZipfs_AppHookβ and only then canTcl_SetPreInitScriptbe called. do not skip this step bestie, it will not slay π
π SEE ALSO π
Tcl_AppInitTcl_Main
β KEYWORDS β
- application
- initialization
- interpreter
and that's the whole page, periodt π
this was the Tcl 9.0 version, dated Tcl_Init(3) β mwah, go forth and source your scripts, you main character ππβ¨
π¦ where this page comes from
- alpine 3.23: tcl9-doc 9.0.3-r0 Β· TCL
- alpine 3.24: tcl9-doc 9.0.3-r2 Β· TCL
- fedora 43: tcl-doc 1:9.0.2-1.fc43 Β· TCL AND GPL-3.0-or-later WITH Bison-exception-2.2 AND BSD-3-Clause
- fedora 44: tcl-doc 1:9.0.2-1.fc44 Β· TCL AND GPL-3.0-or-later WITH Bison-exception-2.2 AND BSD-3-Clause
- nixos 26.05: tcl 9.0.3
- Copyright (c) 1998-2000 Scriptics Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms