1Tcl_StaticPackage(3)        Tcl Library Procedures        Tcl_StaticPackage(3)
2
3
4
5______________________________________________________________________________
6

NAME

8       Tcl_StaticPackage  - make a statically linked package available via the
9       'load' command
10

SYNOPSIS

12       #include <tcl.h>
13
14       Tcl_StaticPackage(interp, pkgName, initProc, safeInitProc)
15

ARGUMENTS

17       Tcl_Interp *interp (in)                         If not NULL, points  to
18                                                       an   interpreter   into
19                                                       which the  package  has
20                                                       already   been   loaded
21                                                       (i.e., the  caller  has
22                                                       already   invoked   the
23                                                       appropriate initializa‐
24                                                       tion  procedure).  NULL
25                                                       means the  package  has
26                                                       not  yet  been incorpo‐
27                                                       rated into  any  inter‐
28                                                       preter.
29
30       const char *pkgName (in)                        Name  of  the  package;
31                                                       should be properly cap‐
32                                                       italized  (first letter
33                                                       upper-case, all  others
34                                                       lower-case).
35
36       Tcl_PackageInitProc *initProc (in)              Procedure  to invoke to
37                                                       incorporate this  pack‐
38                                                       age   into   a  trusted
39                                                       interpreter.
40
41       Tcl_PackageInitProc *safeInitProc (in)          Procedure  to  call  to
42                                                       incorporate  this pack‐
43                                                       age into a safe  inter‐
44                                                       preter  (one  that will
45                                                       execute       untrusted
46                                                       scripts).   NULL  means
47                                                       the package  cannot  be
48                                                       used   in  safe  inter‐
49                                                       preters.
50______________________________________________________________________________
51

DESCRIPTION

53       This procedure may be invoked to  announce  that  a  package  has  been
54       linked  statically  with a Tcl application and, optionally, that it has
55       already been loaded into an interpreter.   Once  Tcl_StaticPackage  has
56       been  invoked  for  a package, it may be loaded into interpreters using
57       the load command.  Tcl_StaticPackage is normally invoked  only  by  the
58       Tcl_AppInit  procedure  for  the application, not by packages for them‐
59       selves (Tcl_StaticPackage should only be invoked for statically  loaded
60       packages,  and  code  in  the  package  itself  should not need to know
61       whether the package is dynamically or statically loaded).
62
63       When the load command is used later to load the package into an  inter‐
64       preter,  one of initProc and safeInitProc will be invoked, depending on
65       whether the target interpreter is safe or not.  initProc and  safeInit‐
66       Proc must both match the following prototype:
67
68              typedef int Tcl_PackageInitProc(
69                      Tcl_Interp *interp);
70
71       The  interp argument identifies the interpreter in which the package is
72       to be loaded.  The  initialization  procedure  must  return  TCL_OK  or
73       TCL_ERROR  to indicate whether or not it completed successfully; in the
74       event of an error it should set the interpreter's result to point to an
75       error  message.   The result or error from the initialization procedure
76       will be returned as the result of the load command that caused the ini‐
77       tialization procedure to be invoked.
78

KEYWORDS

80       initialization procedure, package, static linking
81

SEE ALSO

83       load(n), package(n), Tcl_PkgRequire(3)
84
85
86
87Tcl                                   7.5                 Tcl_StaticPackage(3)
Impressum