Debian Codegraph @

doc/StaticPkg.3

raw
1 '\"
2 '\" Copyright (c) 1995-1996 Sun Microsystems, Inc.
3 '\"
4 '\" See the file "license.terms" for information on usage and redistribution
5 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6 '\"
7 .TH Tcl_StaticPackage 3 7.5 Tcl "Tcl Library Procedures"
8 .so man.macros
9 .BS
10 .SH NAME
11 Tcl_StaticPackage \- make a statically linked package available via the 'load' command
12 .SH SYNOPSIS
13 .nf
14 \fB#include <tcl.h>\fR
15 .sp
16 \fBTcl_StaticPackage\fR(\fIinterp, prefix, initProc, safeInitProc\fR)
17 .SH ARGUMENTS
18 .AS Tcl_PackageInitProc *safeInitProc
19 .AP Tcl_Interp *interp in
20 If not NULL, points to an interpreter into which the package has
21 already been loaded (i.e., the caller has already invoked the
22 appropriate initialization procedure). NULL means the package
23 has not yet been incorporated into any interpreter.
24 .AP "const char" *prefix in
25 Prefix for library initialization function; should be properly
26 capitalized (first letter upper-case, all others lower-case).
27 .AP Tcl_PackageInitProc *initProc in
28 Procedure to invoke to incorporate this package into a trusted
29 interpreter.
30 .AP Tcl_PackageInitProc *safeInitProc in
31 Procedure to call to incorporate this package into a safe interpreter
32 (one that will execute untrusted scripts). NULL means the package
33 cannot be used in safe interpreters.
34 .BE
35 .SH DESCRIPTION
36 .PP
37 This procedure may be invoked to announce that a package has been
38 linked statically with a Tcl application and, optionally, that it
39 has already been loaded into an interpreter.
40 Once \fBTcl_StaticPackage\fR has been invoked for a package, it
41 may be loaded into interpreters using the \fBload\fR command.
42 \fBTcl_StaticPackage\fR is normally invoked only by the \fBTcl_AppInit\fR
43 procedure for the application, not by packages for themselves
44 (\fBTcl_StaticPackage\fR should only be invoked for statically
45 loaded packages, and code in the package itself should not need
46 to know whether the package is dynamically or statically loaded).
47 .PP
48 When the \fBload\fR command is used later to load the package into
49 an interpreter, one of \fIinitProc\fR and \fIsafeInitProc\fR will
50 be invoked, depending on whether the target interpreter is safe
51 or not.
52 \fIinitProc\fR and \fIsafeInitProc\fR must both match the
53 following prototype:
54 .PP
55 .CS
56 typedef int \fBTcl_PackageInitProc\fR(
57 Tcl_Interp *\fIinterp\fR);
58 .CE
59 .PP
60 The \fIinterp\fR argument identifies the interpreter in which the package
61 is to be loaded. The initialization procedure must return \fBTCL_OK\fR or
62 \fBTCL_ERROR\fR to indicate whether or not it completed successfully; in
63 the event of an error it should set the interpreter's result to point to an
64 error message. The result or error from the initialization procedure will
65 be returned as the result of the \fBload\fR command that caused the
66 initialization procedure to be invoked.
67 .SH KEYWORDS
68 initialization procedure, package, static linking
69 .SH "SEE ALSO"
70 load(n), package(n), Tcl_PkgRequire(3)