📄 initstubs.3
字号:
'\"'\" Copyright (c) 1998-1999 Scriptics Corporation'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" RCS: @(#) $Id: InitStubs.3,v 1.8 2002/07/01 18:24:39 jenglish Exp $'\" .so man.macros.TH Tcl_InitStubs 3 8.1 Tcl "Tcl Library Procedures".BS.SH NAMETcl_InitStubs \- initialize the Tcl stubs mechanism.SH SYNOPSIS.nf\fB#include <tcl.h>\fR.spCONST char *\fBTcl_InitStubs\fR(\fIinterp, version, exact\fR).SH ARGUMENTS.AS Tcl_Interp *interp in.AP Tcl_Interp *interp inTcl interpreter handle..AP "CONST char" *version inA version string consisting of one or more decimal numbersseparated by dots..AP int exact inNon-zero means that only the particular version specified by\fIversion\fR is acceptable.Zero means that versions newer than \fIversion\fR are alsoacceptable as long as they have the same major version numberas \fIversion\fR..BE.SH INTRODUCTION.PPThe Tcl stubs mechanism defines a way to dynamically bindextensions to a particular Tcl implementation at run time.This provides two significant benefits to Tcl users:.IP 1) 5Extensions that use the stubs mechanism can be loaded intomultiple versions of Tcl without being recompiled orrelinked..IP 2) 5Extensions that use the stubs mechanism can be dynamicallyloaded into statically-linked Tcl applications..PPThe stubs mechanism accomplishes this by exporting function tablesthat define an interface to the Tcl API. The extension then accessesthe Tcl API through offsets into the function table, so there are nodirect references to any of the Tcl library's symbols. Thisredirection is transparent to the extension, so an extension writercan continue to use all public Tcl functions as documented..PPThe stubs mechanism requires no changes to applications incorporatingTcl interpreters. Only developers creating C-based Tcl extensionsneed to take steps to use the stubs mechanism with their extensions..PPEnabling the stubs mechanism for an extension requires the followingsteps:.IP 1) 5Call \fBTcl_InitStubs\fR in the extension before calling any otherTcl functions..IP 2) 5Define the USE_TCL_STUBS symbol. Typically, you would include the-DUSE_TCL_STUBS flag when compiling the extension..IP 3) 5Link the extension with the Tcl stubs library instead of the standardTcl library. On Unix platforms, the library name is\fIlibtclstub8.1.a\fR; on Windows platforms, the library name is\fItclstub81.lib\fR..PPIf the extension also requires the Tk API, it must also call\fBTk_InitStubs\fR to initialize the Tk stubs interface and linkwith the Tk stubs libraries. See the \fBTk_InitStubs\fR page formore information..SH DESCRIPTION\fBTcl_InitStubs\fR attempts to initialize the stub table pointersand ensure that the correct version of Tcl is loaded. In additionto an interpreter handle, it accepts as arguments a version numberand a Boolean flag indicating whether the extension requiresan exact version match or not. If \fIexact\fR is 0, then theextension is indicating that newer versions of Tcl are acceptableas long as they have the same major version number as \fIversion\fR;non-zero means that only the specified \fIversion\fR is acceptable.\fBTcl_InitStubs\fR returns a string containing the actual versionof Tcl satisfying the request, or NULL if the Tcl version is notacceptable, does not support stubs, or any other error condition occurred..SH "SEE ALSO"Tk_InitStubs.SH KEYWORDSstubs
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -