1Tk_InitStubs(3) Tk Library Procedures Tk_InitStubs(3)
2
3
4
5______________________________________________________________________________
6
8 Tk_InitStubs - initialize the Tk stubs mechanism
9
11 #include <tk.h>
12
13 const char *
14 Tk_InitStubs(interp, version, exact)
15
17 Tcl_Interp *interp (in) Tcl interpreter handle.
18
19 char *version (in) A version string consisting of one or
20 more decimal numbers separated by
21 dots.
22
23 int exact (in) Non-zero means that only the particu‐
24 lar Tk version specified by version is
25 acceptable. Zero means that versions
26 newer than version are also acceptable
27 as long as they have the same major
28 version number as version.
29______________________________________________________________________________
30
32 The Tcl stubs mechanism defines a way to dynamically bind extensions to
33 a particular Tcl implementation at run time. the stubs mechanism
34 requires no changes to applications incorporating Tcl/Tk interpreters.
35 Only developers creating C-based Tcl/Tk extensions need to take steps
36 to use the stubs mechanism with their extensions. See the Tcl_Init‐
37 Stubs page for more information.
38
39 Enabling the stubs mechanism for a Tcl/Tk extension requires the fol‐
40 lowing steps:
41
42 1) Call Tcl_InitStubs in the extension before calling any other Tcl
43 functions.
44
45 2) Call Tk_InitStubs if the extension before calling any other Tk
46 functions.
47
48 2) Define the USE_TCL_STUBS and the USE_TK_STUBS symbols. Typically,
49 you would include the -DUSE_TCL_STUBS and the -DUSE_TK_STUBS flags
50 when compiling the extension.
51
52 3) Link the extension with the Tcl and Tk stubs libraries instead of
53 the standard Tcl and Tk libraries. On Unix platforms, the library
54 names are libtclstub8.4.a and libtkstub8.4.a; on Windows plat‐
55 forms, the library names are tclstub84.lib and tkstub84.lib.
56 Adjust the library names with appropriate version number but note
57 that the extension may only be used with versions of Tcl/Tk that
58 have that version number or higher.
59
61 Tk_InitStubs attempts to initialize the Tk stub table pointers and
62 ensure that the correct version of Tk is loaded. In addition to an
63 interpreter handle, it accepts as arguments a version number and a
64 Boolean flag indicating whether the extension requires an exact version
65 match or not. If exact is 0, then the extension is indicating that
66 newer versions of Tk are acceptable as long as they have the same major
67 version number as version; non-zero means that only the specified ver‐
68 sion is acceptable. Tcl_InitStubs returns a string containing the
69 actual version of Tk satisfying the request, or NULL if the Tk version
70 is not acceptable, does not support the stubs mechanism, or any other
71 error condition occurred.
72
74 Tcl_InitStubs
75
77 stubs
78
79
80
81Tk 8.4 Tk_InitStubs(3)