Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/tcl8.5.2/doc/InitStubs.3 @ 25

Last change on this file since 25 was 25, checked in by landauf, 16 years ago

added tcl to libs

File size: 3.5 KB
Line 
1'\"
2'\" Copyright (c) 1998-1999 Scriptics Corporation
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: InitStubs.3,v 1.11 2004/10/07 15:15:38 dkf Exp $
8'\"
9.so man.macros
10.TH Tcl_InitStubs 3 8.1 Tcl "Tcl Library Procedures"
11.BS
12.SH NAME
13Tcl_InitStubs \- initialize the Tcl stubs mechanism
14.SH SYNOPSIS
15.nf
16\fB#include <tcl.h>\fR
17.sp
18const char *
19\fBTcl_InitStubs\fR(\fIinterp, version, exact\fR)
20.SH ARGUMENTS
21.AS Tcl_Interp *interp
22.AP Tcl_Interp *interp in
23Tcl interpreter handle.
24.AP "const char" *version in
25A version string consisting of one or more decimal numbers
26separated by dots.
27.AP int exact in
28Non-zero means that only the particular version specified by
29\fIversion\fR is acceptable.
30Zero means that versions newer than \fIversion\fR are also
31acceptable as long as they have the same major version number
32as \fIversion\fR.
33.BE
34.SH INTRODUCTION
35.PP
36The Tcl stubs mechanism defines a way to dynamically bind
37extensions to a particular Tcl implementation at run time.
38This provides two significant benefits to Tcl users:
39.IP 1) 5
40Extensions that use the stubs mechanism can be loaded into
41multiple versions of Tcl without being recompiled or
42relinked.
43.IP 2) 5
44Extensions that use the stubs mechanism can be dynamically
45loaded into statically-linked Tcl applications.
46.PP
47The stubs mechanism accomplishes this by exporting function tables
48that define an interface to the Tcl API.  The extension then accesses
49the Tcl API through offsets into the function table, so there are no
50direct references to any of the Tcl library's symbols.  This
51redirection is transparent to the extension, so an extension writer
52can continue to use all public Tcl functions as documented.
53.PP
54The stubs mechanism requires no changes to applications incorporating
55Tcl interpreters.  Only developers creating C-based Tcl extensions
56need to take steps to use the stubs mechanism with their extensions.
57.PP
58Enabling the stubs mechanism for an extension requires the following
59steps:
60.IP 1) 5
61Call \fBTcl_InitStubs\fR in the extension before calling any other
62Tcl functions.
63.IP 2) 5
64Define the \fBUSE_TCL_STUBS\fR symbol.  Typically, you would include the
65\fB\-DUSE_TCL_STUBS\fR flag when compiling the extension.
66.IP 3) 5
67Link the extension with the Tcl stubs library instead of the standard
68Tcl library.  On Unix platforms, the library name is
69\fIlibtclstub8.1.a\fR; on Windows platforms, the library name is
70\fItclstub81.lib\fR.
71.PP
72If the extension also requires the Tk API, it must also call
73\fBTk_InitStubs\fR to initialize the Tk stubs interface and link
74with the Tk stubs libraries.  See the \fBTk_InitStubs\fR page for
75more information.
76.SH DESCRIPTION
77\fBTcl_InitStubs\fR attempts to initialize the stub table pointers
78and ensure that the correct version of Tcl is loaded.  In addition
79to an interpreter handle, it accepts as arguments a version number
80and a Boolean flag indicating whether the extension requires
81an exact version match or not.  If \fIexact\fR is 0, then the
82extension is indicating that newer versions of Tcl are acceptable
83as long as they have the same major version number as \fIversion\fR;
84non-zero means that only the specified \fIversion\fR is acceptable.
85\fBTcl_InitStubs\fR returns a string containing the actual version
86of Tcl satisfying the request, or NULL if the Tcl version is not
87acceptable, does not support stubs, or any other error condition occurred.
88.SH "SEE ALSO"
89Tk_InitStubs
90.SH KEYWORDS
91stubs
Note: See TracBrowser for help on using the repository browser.