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
52

DESCRIPTION

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

KEYWORDS

79       initialization procedure, package, static linking
80
81
82
83Tcl                                   7.5                 Tcl_StaticPackage(3)
Impressum