1Tcl_PkgRequire(3) Tcl Library Procedures Tcl_PkgRequire(3)
2
3
4
5______________________________________________________________________________
6
8 Tcl_PkgRequire, Tcl_PkgRequireEx, Tcl_PkgRequireProc, Tcl_PkgPresent,
9 Tcl_PkgPresentEx, Tcl_PkgProvide, Tcl_PkgProvideEx - package version
10 control
11
13 #include <tcl.h>
14
15 const char *
16 Tcl_PkgRequire(interp, name, version, exact)
17
18 const char *
19 Tcl_PkgRequireEx(interp, name, version, exact, clientDataPtr)
20
21 int
22 Tcl_PkgRequireProc(interp, name, objc, objv, clientDataPtr)
23
24 const char *
25 Tcl_PkgPresent(interp, name, version, exact)
26
27 const char *
28 Tcl_PkgPresentEx(interp, name, version, exact, clientDataPtr)
29
30 int
31 Tcl_PkgProvide(interp, name, version)
32
33 int
34 Tcl_PkgProvideEx(interp, name, version, clientData)
35
37 Tcl_Interp *interp (in) Interpreter where package is needed
38 or available.
39
40 const char *name (in) Name of package.
41
42 const char *version (in) A version string consisting of one or
43 more decimal numbers separated by
44 dots.
45
46 int exact (in) Non-zero means that only the particu‐
47 lar version specified by version is
48 acceptable. Zero means that newer
49 versions than version are also
50 acceptable as long as they have the
51 same major version number as version.
52
53 const void *clientData (in) Arbitrary value to be associated with
54 the package.
55
56 void *clientDataPtr (out) Pointer to place to store the value
57 associated with the matching package.
58 It is only changed if the pointer is
59 not NULL and the function completed
60 successfully. The storage can be any
61 pointer type with the same size as a
62 void pointer.
63
64 int objc (in) Number of requirements.
65
66 Tcl_Obj* objv[] (in) Array of requirements.
67______________________________________________________________________________
68
70 These procedures provide C-level interfaces to Tcl's package and ver‐
71 sion management facilities.
72
73 Tcl_PkgRequire is equivalent to the package require command, Tcl_PkgP‐
74 resent is equivalent to the package present command, and Tcl_PkgProvide
75 is equivalent to the package provide command.
76
77 See the documentation for the Tcl commands for details on what these
78 procedures do.
79
80 If Tcl_PkgPresent or Tcl_PkgRequire complete successfully they return a
81 pointer to the version string for the version of the package that is
82 provided in the interpreter (which may be different than version); if
83 an error occurs they return NULL and leave an error message in the
84 interpreter's result.
85
86 Tcl_PkgProvide returns TCL_OK if it completes successfully; if an error
87 occurs it returns TCL_ERROR and leaves an error message in the inter‐
88 preter's result.
89
90 Tcl_PkgProvideEx, Tcl_PkgPresentEx and Tcl_PkgRequireEx allow the set‐
91 ting and retrieving of the client data associated with the package. In
92 all other respects they are equivalent to the matching functions.
93
94 Tcl_PkgRequireProc is the form of package require handling multiple
95 requirements. The other forms are present for backward compatibility
96 and translate their invocations to this form.
97
99 package, present, provide, require, version
100
102 package(n), Tcl_StaticPackage(3)
103
104
105
106Tcl 7.5 Tcl_PkgRequire(3)