Debian Codegraph @

docs/programmer_reference/tcl.html

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <title>Chapter 21.  Berkeley DB Extensions: Tcl</title>
7 <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9 <link rel="start" href="index.html" title="Berkeley DB Programmer's Reference Guide" />
10 <link rel="up" href="index.html" title="Berkeley DB Programmer's Reference Guide" />
11 <link rel="prev" href="sequence.html" title="Chapter 20.  Sequences" />
12 <link rel="next" href="tcl_using.html" title="Using Berkeley DB with Tcl" />
13 </head>
14 <body>
15 <div xmlns="" class="navheader">
16 <div class="libver">
17 <p>Library Version 11.2.5.3</p>
18 </div>
19 <table width="100%" summary="Navigation header">
20 <tr>
21 <th colspan="3" align="center">Chapter 21. 
22 Berkeley DB Extensions: Tcl
23 </th>
24 </tr>
25 <tr>
26 <td width="20%" align="left"><a accesskey="p" href="sequence.html">Prev</a> </td>
27 <th width="60%" align="center"> </th>
28 <td width="20%" align="right"> <a accesskey="n" href="tcl_using.html">Next</a></td>
29 </tr>
30 </table>
31 <hr />
32 </div>
33 <div class="chapter" lang="en" xml:lang="en">
34 <div class="titlepage">
35 <div>
36 <div>
37 <h2 class="title"><a id="tcl"></a>Chapter 21. 
38 Berkeley DB Extensions: Tcl
39 </h2>
40 </div>
41 </div>
42 </div>
43 <div class="toc">
44 <p>
45 <b>Table of Contents</b>
46 </p>
47 <dl>
48 <dt>
49 <span class="sect1">
50 <a href="tcl.html#tcl_intro">Loading Berkeley DB with Tcl</a>
51 </span>
52 </dt>
53 <dd>
54 <dl>
55 <dt>
56 <span class="sect2">
57 <a href="tcl.html#idp53366464">Installing as a Tcl Package</a>
58 </span>
59 </dt>
60 <dt>
61 <span class="sect2">
62 <a href="tcl.html#idp53356912">Loading Berkeley DB with Tcl</a>
63 </span>
64 </dt>
65 </dl>
66 </dd>
67 <dt>
68 <span class="sect1">
69 <a href="tcl_using.html">Using Berkeley DB with Tcl</a>
70 </span>
71 </dt>
72 <dt>
73 <span class="sect1">
74 <a href="tcl_program.html">Tcl API programming notes</a>
75 </span>
76 </dt>
77 <dt>
78 <span class="sect1">
79 <a href="tcl_error.html">Tcl error handling</a>
80 </span>
81 </dt>
82 <dt>
83 <span class="sect1">
84 <a href="tcl_faq.html">Tcl FAQ</a>
85 </span>
86 </dt>
87 </dl>
88 </div>
89 <div class="sect1" lang="en" xml:lang="en">
90 <div class="titlepage">
91 <div>
92 <div>
93 <h2 class="title" style="clear: both"><a id="tcl_intro"></a>Loading Berkeley DB with Tcl</h2>
94 </div>
95 </div>
96 </div>
97 <div class="toc">
98 <dl>
99 <dt>
100 <span class="sect2">
101 <a href="tcl.html#idp53366464">Installing as a Tcl Package</a>
102 </span>
103 </dt>
104 <dt>
105 <span class="sect2">
106 <a href="tcl.html#idp53356912">Loading Berkeley DB with Tcl</a>
107 </span>
108 </dt>
109 </dl>
110 </div>
111 <p>Berkeley DB includes a dynamically loadable Tcl API, which requires that
112 Tcl/Tk 8.5 or later already be installed on your system. You can
113 download a copy of Tcl from the <a class="ulink" href="http://www.tcl.tk" target="_top">Tcl
114 Developer Xchange</a> Web site.</p>
115 <p>This document assumes that you already configured Berkeley DB for Tcl
116 support, and you have built and installed everything where you want it
117 to be. If you have not done so, see
118 <a href="../installation/build_unix_conf.html" class="olink">Configuring Berkeley DB</a> or <a href="../installation/build_win_tcl.html" class="olink">Building the Tcl API</a> in the Berkeley DB Installation and Build Guide for more
119 information.</p>
120 <div class="sect2" lang="en" xml:lang="en">
121 <div class="titlepage">
122 <div>
123 <div>
124 <h3 class="title"><a id="idp53366464"></a>Installing as a Tcl Package</h3>
125 </div>
126 </div>
127 </div>
128 <p>Once enabled, the Berkeley DB shared library for Tcl is automatically installed
129 as part of the standard installation process. However, if you want to be
130 able to dynamically load it as a Tcl package into your script, there are
131 several steps that must be performed:</p>
132 <div class="orderedlist">
133 <ol type="1">
134 <li>Run the Tcl shell in the install directory.</li>
135 <li>Append this directory to your auto_path variable.</li>
136 <li>Run the pkg_mkIndex proc, giving the name of the Berkeley DB Tcl library.</li>
137 </ol>
138 </div>
139 <p>For example:</p>
140 <pre class="programlisting"># tclsh8.5
141 % lappend auto_path /usr/local/BerkeleyDB.5.2/lib
142 % pkg_mkIndex /usr/local/BerkeleyDB.5.2/lib libdb_tcl-5.2.so</pre>
143 <p>Note that your Tcl and Berkeley DB version numbers may differ from the
144 example, and so your tclsh and library names may be different.</p>
145 </div>
146 <div class="sect2" lang="en" xml:lang="en">
147 <div class="titlepage">
148 <div>
149 <div>
150 <h3 class="title"><a id="idp53356912"></a>Loading Berkeley DB with Tcl</h3>
151 </div>
152 </div>
153 </div>
154 <p>The Berkeley DB package may be loaded into the user's interactive Tcl script
155 (or wish session) via the <span class="bold"><strong>load</strong></span> command. For example:</p>
156 <pre class="programlisting">load /usr/local/BerkeleyDB.5.2/lib/libdb_tcl-5.2.so</pre>
157 <p>Note that your Berkeley DB version numbers may differ from the example, and so
158 the library name may be different.</p>
159 <p>If you installed your library to run as a Tcl package, Tcl application
160 scripts should use the <span class="bold"><strong>package</strong></span> command to indicate to the Tcl
161 interpreter that it needs the Berkeley DB package and where to find it. For
162 example:</p>
163 <pre class="programlisting">lappend auto_path "/usr/local/BerkeleyDB.5.2/lib"
164 package require Db_tcl</pre>
165 <p>No matter which way the library gets loaded, it creates a command named
166 <span class="bold"><strong>berkdb</strong></span>. All the Berkeley DB functionality is accessed via this
167 command and additional commands it creates on behalf of the application.
168 A simple test to determine whether everything is loaded and ready is to
169 display the library version, as follows:</p>
170 <pre class="programlisting">berkdb version -string</pre>
171 <p>This should return you the Berkeley DB version in a string format.</p>
172 </div>
173 </div>
174 </div>
175 <div class="navfooter">
176 <hr />
177 <table width="100%" summary="Navigation footer">
178 <tr>
179 <td width="40%" align="left"><a accesskey="p" href="sequence.html">Prev</a> </td>
180 <td width="20%" align="center"> </td>
181 <td width="40%" align="right"> <a accesskey="n" href="tcl_using.html">Next</a></td>
182 </tr>
183 <tr>
184 <td width="40%" align="left" valign="top">Chapter 20. 
185 Sequences
186  </td>
187 <td width="20%" align="center">
188 <a accesskey="h" href="index.html">Home</a>
189 </td>
190 <td width="40%" align="right" valign="top"> Using Berkeley DB with Tcl</td>
191 </tr>
192 </table>
193 </div>
194 </body>
195 </html>