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
38 needed or available.
39
40 const char *name (in) Name of package.
41
42 const char *version (in) A version string consisting of
43 one or more decimal numbers sep‐
44 arated by dots.
45
46 int exact (in) Non-zero means that only the
47 particular version specified by
48 version is acceptable. Zero
49 means that newer versions than
50 version are also acceptable as
51 long as they have the same major
52 version number as version.
53
54 ClientData clientData (in) Arbitrary value to be associated
55 with the package.
56
57 ClientData *clientDataPtr (out) Pointer to place to store the
58 value associated with the match‐
59 ing package. It is only changed
60 if the pointer is not NULL and
61 the function completed success‐
62 fully.
63
64 int objc (in) Number of requirements.
65
66 Tcl_Obj* objv[] (in) Array of requirements.
67_________________________________________________________________
68
69
71 These procedures provide C-level interfaces to Tcl's package and ver‐
72 sion management facilities.
73
74 Tcl_PkgRequire is equivalent to the package require command, Tcl_PkgP‐
75 resent is equivalent to the package present command, and Tcl_PkgProvide
76 is equivalent to the package provide command.
77
78 See the documentation for the Tcl commands for details on what these
79 procedures do.
80
81 If Tcl_PkgPresent or Tcl_PkgRequire complete successfully they return a
82 pointer to the version string for the version of the package that is
83 provided in the interpreter (which may be different than version); if
84 an error occurs they return NULL and leave an error message in the
85 interpreter's result.
86
87 Tcl_PkgProvide returns TCL_OK if it completes successfully; if an error
88 occurs it returns TCL_ERROR and leaves an error message in the inter‐
89 preter's result.
90
91 Tcl_PkgProvideEx, Tcl_PkgPresentEx and Tcl_PkgRequireEx allow the set‐
92 ting and retrieving of the client data associated with the package. In
93 all other respects they are equivalent to the matching functions.
94
95 Tcl_PkgRequireProc is the form of package require handling multiple
96 requirements. The other forms are present for backward compatibility
97 and translate their invocations to this form.
98
99
101 package, present, provide, require, version
102
103
104
105Tcl 7.5 Tcl_PkgRequire(3)