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