Tcl_OOInitStubs(3)

✨ NAME ✨

Tcl_OOInitStubs β€” bestie, this is the lil function that initializes your library's access to all the TclOO functionality πŸ’…


🌸 SYNOPSIS 🌸

#include <tclOO.h>

const char *
Tcl_OOInitStubs(interp)

πŸŽ€ ARGUMENTS πŸŽ€

  • Tcl_Interp *interp (in) β€” the Tcl interpreter that the TclOO API is integrated with, aka the one whose C interface you're about to be using, no cap πŸ’–

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so, when your extension library is gonna use the C interface that TclOO exposes, you call Tcl_OOInitStubs to set up your access to that interface. Where do you call it? From inside your *_Init (or *_SafeInit) function, and you pass in the interp that got handed to that routine as context. That's the whole vibe ✨

Now, the plot twist: if Tcl_OOInitStubs hands you back NULL, that means the initialization failed, and an error message will have been left sitting in the interpreter's result. 😭 If you get anything else, you're golden β€” initialization succeeded, the TclOO API is yours to use from that point on, and the return value is the version of the TclOO API. πŸ‘‘

And here's the choose-your-own-adventure part, bestie, you have to pick one:

  • the C #define symbol USE_TCLOO_STUBS gets defined, and your library code is linked against the Tcl stub library, or
  • that #define symbol does not get defined, and your library code is linked against the Tcl main library directly.

Pick one, don't be chaotic about it 🫢


πŸ’€ BACKWARD COMPATIBILITY NOTE πŸ’€

If you're linking against the Tcl 8.5 forward compatibility package for TclOO, heads up: only the stub-enabled configuration is supported. So you should also link against the TclOO independent stub library. And fun fact, that library is an integrated part of the main Tcl stub library in Tcl 8.6 🌈

Not me warning you that the 8.5 route has exactly one (1) supported configuration. The stub-enabled one. That's it. That's the option. πŸ™ˆ

🌟 KEYWORDS 🌟

stubs


πŸ’œ SEE ALSO πŸ’œ


That's the whole page, bestie, go forth and stub responsibly πŸŽ€ This one's from the TclOO manual, version 1.0, and it lives under the name Tcl_OOInitStubs(3) β€” slay, ate, periodt πŸ’…βœ¨

πŸ“¦ where this page comes from