• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/db-4.8.30/docs/programmer_reference/
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��25.�� Building Berkeley DB for the BREW simulator</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="debug_printlog.html" title="Reviewing Berkeley DB log files" />
12    <link rel="next" href="ch25s02.html" title="Building a BREW applet for the physical device" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">Chapter��25.��
19		Building Berkeley DB for the BREW simulator
20        </th>
21        </tr>
22        <tr>
23          <td width="20%" align="left"><a accesskey="p" href="debug_printlog.html">Prev</a>��</td>
24          <th width="60%" align="center">��</th>
25          <td width="20%" align="right">��<a accesskey="n" href="ch25s02.html">Next</a></td>
26        </tr>
27      </table>
28      <hr />
29    </div>
30    <div class="chapter" lang="en" xml:lang="en">
31      <div class="titlepage">
32        <div>
33          <div>
34            <h2 class="title"><a id="build_brew"></a>Chapter��25.��
35		Building Berkeley DB for the BREW simulator
36        </h2>
37          </div>
38        </div>
39      </div>
40      <div class="toc">
41        <p>
42          <b>Table of Contents</b>
43        </p>
44        <dl>
45          <dt>
46            <span class="sect1">
47              <a href="build_brew.html#id1628111">Building a BREW applet with Berkeley DB library</a>
48            </span>
49          </dt>
50          <dt>
51            <span class="sect1">
52              <a href="ch25s02.html">Building a BREW applet for the physical device</a>
53            </span>
54          </dt>
55        </dl>
56      </div>
57      <p>This chapter has general instructions for building the Berkeley DB library
58and applets for the BREW platform.</p>
59      <p>The <code class="filename">build_brew</code> directory in the Berkeley DB distribution contains
60project files for Microsoft Visual C++:</p>
61      <div class="informaltable">
62        <table border="1" width="80%">
63          <colgroup>
64            <col />
65            <col />
66          </colgroup>
67          <thead>
68            <tr>
69              <th>Project File</th>
70              <th>Description</th>
71            </tr>
72          </thead>
73          <tbody>
74            <tr>
75              <td align="left">bdb_brew.dsw</td>
76              <td align="left">Visual C++ 6.0 workspace</td>
77            </tr>
78            <tr>
79              <td align="left">bdb_brew.dsp</td>
80              <td align="left">Visual C++ 6.0 project</td>
81            </tr>
82          </tbody>
83        </table>
84      </div>
85      <p>The project file can be used to build the Berkeley DB library for the BREW
86platform. Both BREW SDK versions 2 and 3 are supported.  By default, the
87build is for BREW SDK version 2.</p>
88      <p>The steps for building the Berkeley DB library for the BREW Simulator are as
89follows:</p>
90      <div class="orderedlist">
91        <ol type="1">
92          <li>Install the BREW SDK and BREW SDK Tools.</li>
93          <li>To build for BREW SDK version 3, edit the Berkeley DB source distribution file
94<code class="filename">build_brew/db_config.h</code> file and <span class="bold"><strong>remove</strong></span> the line
95"#define HAVE_BREW_SDK2".  No changes are required to build for BREW SDK
96version 2.</li>
97          <li>Select <span class="emphasis"><em>File -&gt; Open Workspace</em></span>.  Look in the build_brew
98directory for Workspaces, select <span class="emphasis"><em>bdb_brew.dsw</em></span>, and select
99<span class="emphasis"><em>Open</em></span>.</li>
100          <li>The BREW SDK creates an environment entry "BREWDIR" after the SDK
101installation. Confirm the entry exists, and if not, create an
102environment entry which points to the BREW SDK's root directory.</li>
103          <li>For the BREW platform, only the project "bdb_brew" is available.  Set
104the bdb_brew project as the active project and select the appropriate
105option for the build_all project (Debug or Release). Then select
106<span class="emphasis"><em>OK</em></span>.</li>
107          <li>To build, press F7.</li>
108        </ol>
109      </div>
110      <p>The build results are placed in a subdirectory of build_brew named after
111the selected configuration (for example, <code class="filename">build_brew\Release</code> or
112<code class="filename">build_brew\Debug</code>).</p>
113      <p>When building the application during development, you should normally
114use compile options "Debug Multithreaded DLL" and link against
115<code class="filename">build_brew\Debug\bdb_brew.lib</code>. You can also build using a
116release version of the Berkeley DB libraries and tools, which will be placed
117in <code class="filename">build_brew\Release\bdb_brew.lib</code>. When linking against the
118release build, you should compile your code with the "Release
119Multithreaded DLL" compile option. You will also need to add the
120<code class="filename">build_brew</code> directory to the list of include directories of your
121application's project, or copy the Berkeley DB include files to another
122location.</p>
123      <div class="sect1" lang="en" xml:lang="en">
124        <div class="titlepage">
125          <div>
126            <div>
127              <h2 class="title" style="clear: both"><a id="id1628111"></a>Building a BREW applet with Berkeley DB library</h2>
128            </div>
129          </div>
130        </div>
131        <p>Building a Berkeley DB application in the BREW environment is similar to
132building in a Windows environment.  Ensure that <code class="filename">db.h</code> is in the
133build include path and <code class="filename">bdb_brew.lib</code> is in the build library
134path (alternatively, you can add project dependencies to the
135<code class="filename">bdb_brew</code> project).</p>
136        <p>BREW applets require a few minor additions:</p>
137        <div class="orderedlist">
138          <ol type="1">
139            <li>The <span class="bold"><strong>BDBApp</strong></span> structure must be extended -- the extended
140definition of BDBApp is found in the include file <code class="filename">db.h</code>.</li>
141            <li>Before any Berkeley DB operations are performed, the applet must call the "int
142brew_bdb_begin(void)" function.  This function returns 0 on success, and
143non-zero on failure.</li>
144            <li>After the last Berkeley DB operation is performed, the applet must call the
145"void brew_bdb_end(void)" function.  Note that the brew_bdb_end function
146cannot be called in the applet "cleanup" function.  If that is a
147requirement, use the following code instead:
148<pre class="programlisting">BDBApp *pMe=(BDBApp *)po;
149if (pMe-&gt;db_global_values != NULL)
150	FREE(pMe-&gt;db_global_values);</pre></li>
151          </ol>
152        </div>
153      </div>
154    </div>
155    <div class="navfooter">
156      <hr />
157      <table width="100%" summary="Navigation footer">
158        <tr>
159          <td width="40%" align="left"><a accesskey="p" href="debug_printlog.html">Prev</a>��</td>
160          <td width="20%" align="center">��</td>
161          <td width="40%" align="right">��<a accesskey="n" href="ch25s02.html">Next</a></td>
162        </tr>
163        <tr>
164          <td width="40%" align="left" valign="top">Reviewing Berkeley DB log files��</td>
165          <td width="20%" align="center">
166            <a accesskey="h" href="index.html">Home</a>
167          </td>
168          <td width="40%" align="right" valign="top">��Building a BREW applet for the physical device</td>
169        </tr>
170      </table>
171    </div>
172  </body>
173</html>
174