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 of Tcl_InitSubsystems, Tcl_SetPanicProc, Tcl_FindExecutable or TclZipfs_AppHook β€” and only then can Tcl_SetPreInitScript be called. do not skip this step bestie, it will not slay πŸ’€

🌈 SEE ALSO 🌈

  • Tcl_AppInit
  • Tcl_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