summaryrefslogtreecommitdiffstats
path: root/doc/load.n
diff options
context:
space:
mode:
Diffstat (limited to 'doc/load.n')
-rw-r--r--doc/load.n33
1 files changed, 19 insertions, 14 deletions
diff --git a/doc/load.n b/doc/load.n
index e5501f6..c32cb65 100644
--- a/doc/load.n
+++ b/doc/load.n
@@ -17,7 +17,6 @@ load \- Load machine code and initialize new commands
.br
\fBload \fIfileName packageName interp\fR
.BE
-
.SH DESCRIPTION
.PP
This command loads binary code from a file into the
@@ -56,9 +55,12 @@ by the package that is safe for use by untrusted code. For more information
on Safe\-Tcl, see the \fBsafe\fR manual entry.
.PP
The initialization procedure must match the following prototype:
+.PP
.CS
-typedef int Tcl_PackageInitProc(Tcl_Interp *\fIinterp\fR);
+typedef int \fBTcl_PackageInitProc\fR(
+ Tcl_Interp *\fIinterp\fR);
.CE
+.PP
The \fIinterp\fR argument identifies the interpreter in which the
package is to be loaded. The initialization procedure must return
\fBTCL_OK\fR or \fBTCL_ERROR\fR to indicate whether or not it completed
@@ -71,12 +73,10 @@ in an application. If a given \fIfileName\fR is loaded into multiple
interpreters, then the first \fBload\fR will load the code and
call the initialization procedure; subsequent \fBload\fRs will
call the initialization procedure without loading the code again.
-.VS 8.5
For Tcl versions lower than 8.5, it is not possible to unload or reload a
package. From version 8.5 however, the \fBunload\fR command allows the unloading
of libraries loaded with \fBload\fR, for libraries that are aware of the
Tcl's unloading mechanism.
-.VE 8.5
.PP
The \fBload\fR command also supports packages that are statically
linked with the application, if those packages have been registered
@@ -119,9 +119,12 @@ When loading a DLL in the current directory, Windows will ignore
.QW ./
as a path specifier and use a search heuristic to find the DLL instead.
To avoid this, load the DLL with:
+.RS
+.PP
.CS
\fBload\fR [file join [pwd] mylib.DLL]
.CE
+.RE
.SH BUGS
.PP
If the same file is \fBload\fRed by different \fIfileName\fRs, it will
@@ -129,6 +132,7 @@ be loaded into the process's address space multiple times. The
behavior of this varies from system to system (some systems may
detect the redundant loads, others may not).
.SH EXAMPLE
+.PP
The following is a minimal extension:
.PP
.CS
@@ -156,20 +160,21 @@ it can then be loaded into Tcl with the following:
.CS
# Load the extension
switch $tcl_platform(platform) {
- windows {
- \fBload\fR [file join [pwd] foo.dll]
- }
- unix {
- \fBload\fR [file join [pwd] libfoo[info sharedlibextension]]
- }
+ windows {
+ \fBload\fR [file join [pwd] foo.dll]
+ }
+ unix {
+ \fBload\fR [file join [pwd] libfoo[info sharedlibextension]]
+ }
}
# Now execute the command defined by the extension
foo
.CE
-
.SH "SEE ALSO"
-info sharedlibextension, Tcl_StaticPackage(3), safe(n)
-
+info sharedlibextension, package(n), Tcl_StaticPackage(3), safe(n)
.SH KEYWORDS
-binary code, loading, safe interpreter, shared library
+binary code, dynamic library, load, safe interpreter, shared library
+'\"Local Variables:
+'\"mode: nroff
+'\"End: