Tcl_Init(3tcl)
π NAME π
Tcl_Init β find and source that initialization script, bestie πβ¨
πΈ SYNOPSIS πΈ
#include <tcl.h>
int
Tcl_Init(interp)
const char *
Tcl_SetPreInitScript(scriptPtr)
π ARGUMENTS π
Tcl_Interp *interp(in) β the interpreter we're initializing, periodt.const char *scriptPtr(in) β the address of the initialization script. Yes, the actual address. Give it here. π«Ά
β¨ DESCRIPTION β¨
Tcl_Init is your lil helper procedure that goes and finds the init.tcl script, then sources it. That script should be living somewhere on the Tcl library path β that's the vibe check it's doing. π
Like, usually you'd call Tcl_Init from inside your Tcl_AppInit procedures. That's the moment. That's the main character energy. π
Now, Tcl_SetPreInitScript is the fun one. It registers the pre-initialization script and hands you back the former script pointer β the one that just got replaced. So you're not just setting, you're swapping. π
A value ofNULLmay be passed to not register any script. So if you wanna clear it out,NULLis your girl. π«
The pre-initialization script gets executed by Tcl_Init before accessing the file system. Why do we care? Because the whole purpose is to typically prepare a custom file system (think: an embedded zip-file, iconic) so it can be activated before the search happens. Setup first, search second. No cap. ποΈβ¨
And here's the important bit for the stub-enabled embedders out there β listen up, this one's a real caveat π
When you're working with stub-enabled embedders, the stubs table has to be initialized first, using one of these:
Tcl_InitSubsystemsTcl_SetPanicProcTcl_FindExecutableTclZipfs_AppHook
...and only then may Tcl_SetPreInitScript be called. Order matters, bestie. Do it out of order and it's giving chaos. π
π¦ SEE ALSO π¦
Tcl_AppInitTcl_Main
π KEYWORDS π
application, initialization, interpreter
okay that's the whole page, you ate it, you understood it, I'm so proud of you fr fr π₯Ήπ«Ά
this was brought to you by Tcl 9.0, and the page itself is Tcl_Init(3tcl) β mwah, go write something slay πβ¨
π¦ where this page comes from
- debian trixie: tcl9.0-doc 9.0.1+dfsg-2
- ubuntu questing: tcl9.0-doc 9.0.2+dfsg-1
- ubuntu resolute: tcl9.0-doc 9.0.3+dfsg-1
- ubuntu stonking: tcl9.0-doc 9.0.4+dfsg-1
- 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