1
<!--"@(#)intro.so 10.26 (Sleepycat) 11/18/99"-->
2
<!--Copyright 1997-2002 by Sleepycat Software, Inc.-->
3
<!--All rights reserved.-->
4
<!--See the file LICENSE for redistribution information.-->
7
<title>Berkeley DB Reference Guide: Building for Win32</title>
8
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
9
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
12
<a name="2"><!--meow--></a>
13
<table width="100%"><tr valign=top>
14
<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Building Berkeley DB for Windows systems</dl></h3></td>
15
<td align=right><a href="../../ref/build_unix/ultrix.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/build_win/test.html"><img src="../../images/next.gif" alt="Next"></a>
18
<h1 align=center>Building for Win32</h1>
19
<p>The build_win32 directory in the Berkeley DB distribution contains project files
20
for Microsoft Visual C++:
21
<p><table border=1 align=center>
22
<tr><th>Project File</th><th>Description</th></tr>
23
<tr> <td align=center>Berkeley_DB.dsw</td> <td align=center>Visual C++ 6.0 workspace</td> </tr>
24
<tr> <td align=center>*.dsp</td> <td align=center>Visual C++ 6.0 projects</td> </tr>
26
<p>These project files can be used to build Berkeley DB for any Win32 platform:
27
Windows/XP, Windows/2000, Windows/NT, Windows/98 and Windows/95.
28
<h3>Building Berkeley DB with Visual C++</h3>
29
<p>Open the file <b>Berkeley_DB.dsw</b>. This workspace includes a number
30
of subprojects needed to build Berkeley DB. To do this in Visual C++ .NET,
31
choose <i>Open Solution</i> from the <i>File</i> menu. Then
32
choose <i>Compatible Workspace Files</i> under <i>Files of
33
type</i>. After you select <b>Berkeley_DB.dsw</b>, you will be prompted to
34
upgrade the project files. Choose <i>Yes to All</i>.
35
<p>First, you'll need to set the include directories. To do this, select
36
<i>Options...</i> from the <i>Tools</i> pull-down menu. In Visual
37
C++ 6.0, a tabbed dialog should appear. Choose the <i>Directories</i>
38
tab in the dialog, and for the <i>Platform</i>, select
39
<i>Win32</i>. In Visual C++ .NET, a different window appears. Choose
40
<i>Projects</i>, then <i>VC++ Directories</i>.
41
<p>In either case, choose <i>Include files</i> under <i>Show
42
directories for</i>. You should then add two directories to the list of
43
directories: the full pathname of the <i>build_win32</i> subdirectory
44
of Berkeley DB, followed by the full pathname of the <i>dbinc</i>
45
subdirectory of Berkeley DB. Then click OK.
46
<p>In Visual C++ 6.0, select <i>Active Project Configuration</i> under
47
the <i>Build</i> pull-down menu. For a debug version of the
48
libraries, tools, and examples, select <i>build_all -- Win32
49
Debug</i>. Results from this build are put into <b>build_win32/Debug</b>.
50
For a release version, select <i>build_all -- Win32 Release</i>;
51
results are put into <b>build_win32/Release</b>. For a debug version
52
that has all tools and examples built with static libraries, select
53
<i>build_all -- Win32 Debug Static</i>; results are put into
54
<b>build_win32/Debug_static</b>. For a release version of the same,
55
select <i>build_all -- Win32 Release Static</i>; results are put into
56
<b>build_win32/Release_static</b>. Finally, to build, select
57
<i>Build build_all.exe</i> under the <i>Build</i> pull-down
59
<p>In Visual C++ .NET, choose the configuration from the drop down list on
60
the tool bar (<i>Debug</i>, <i>Release</i>, <i>Debug
61
Static</i> or <i>Release Static</i>). Then, to build, right-click on
62
<i>build_all</i> and choose <i>Build</i>.
63
<p>When building your application, you should normally use compile options
64
"debug multithreaded dll" and link against
65
<b>build_win32/Debug/libdb41d.lib</b>. If you want to
66
link against a static (non-DLL) version of the library, use the "debug
67
multithreaded" compile options and link against
68
<b>build_win32/Debug_static/libdb41sd.lib</b>. You
69
can also build using a release version of the libraries and tools, which
71
<b>build_win32/Release/libdb41.lib</b>. The static
73
<b>build_win32/Release_static/libdb41s.lib</b>.
74
<p>Each release of Berkeley DB is built and tested with this procedure using
75
Microsoft Visual C++ 6.0, Standard Version and Microsoft Visual C++ .NET,
77
<h3>Building the C++ API</h3>
78
<p>C++ support is built automatically on Win32.
79
<h3>Building the Java API</h3>
80
<p>Java support is not built automatically. The following instructions
81
assume that you have installed the Sun Java Development Kit in
82
<b>d:/java</b>. Of course, if you installed elsewhere or have different
83
Java software, you will need to adjust the pathnames accordingly. First,
84
use the previous instructions to open the Tools/Options window for adding
85
include directories. In addition to the directories specified previously,
86
add <b>d:/java/include</b> and <b>d:/java/include/win32</b>. These
87
are the directories needed when including <b>jni.h</b>. Now, before
88
clicking OK, choose <i>Executable files</i> under <i>Show
89
directories for</i>. Add <b>d:/java/bin</b>. That directory is needed to
90
find javac. Now select OK.
91
<p>In Visual C++ 6.0, select <i>Active Project Configuration</i> under
92
the <i>Build</i> pull-down menu. Choose <i>db_java -- Win32
93
Release</i>. To build, select <i>Build
94
libdb_java41.dll</i> under the <i>Build</i> pull-down
95
menu. This builds the Java support library for Berkeley DB and compiles all the
96
java files, placing the resulting <b>db.jar</b> and
97
<b>dbexamples.jar</b> files in the <b>build_win32/Release</b>
98
subdirectory of Berkeley DB.
99
<p>In Visual C++ .NET, set the build type to <i>Release</i> in the drop
100
down list on the toolbar, then right-click on <i>db_java</i> and
102
<p>To run Java code, set your environment variable <b>CLASSPATH</b> to
103
include the full pathname of these jar files, and your environment
104
variable <b>PATH</b> to include the <b>build_win32/Release</b>
105
subdirectory. On Windows, remember that files or directories in the
106
<b>CLASSPATH</b> and <b>PATH</b> variables must be separated by
107
semicolons (unlike UNIX). Then, try running the following command as a
109
<p><blockquote><pre>java com.sleepycat.examples.AccessExample</pre></blockquote>
110
<p>If you want to run Java code using a Debug build, it is slightly more
111
complicated. Make sure you build the Debug version of <i>db_java</i>
112
instead of the Release version. Also make sure that your <b>PATH</b>
113
contains <b>build_win32/Debug</b>. Then run the following (as one
115
<p><blockquote><pre>java -dsleepycat.db.libname=libdb_java41d com.sleepycat.examples.AccessExample</pre></blockquote>
116
<h3>Building the Tcl API</h3>
117
<p>Tcl support is not built automatically. See
118
<a href="../../ref/tcl/intro.html">Loading Berkeley DB with Tcl</a> for information on
119
sites from which you can download Tcl and which Tcl versions are
120
compatible with Berkeley DB.
121
<p>The Tcl library must be built as the same build type as the Berkeley DB library
122
(both Release or both Debug). We found that the binary release of Tcl can
123
be used with the Release configuration of Berkeley DB, but you will need to need
124
to build Tcl from sources for the Debug configuration. Before building
125
Tcl, you will need to modify its makefile to make sure that you are
126
building a debug version, including thread support. This is because the
127
set of DLLs linked into the Tcl executable must match the corresponding
128
set of DLLs used by Berkeley DB.
129
<p>These notes assume that Tcl is installed as <b>d:/tcl</b>, but you can
130
change that if you want. If you run using a version of Tcl different from
131
the one currently being used by Sleepycat Software, you will need to
132
change the name of the Tcl library used in the build (for example,
133
<b>tcl83d.lib</b>) to the appropriate name. See
134
Projects->Settings->Link in the db_tcl subproject.
135
<p>Use the previous instructions for Visual C++ to open the
136
<i>Tools/Options</i> window for adding include directories. In
137
addition to the directories specified previously, add
138
<b>d:/tcl/include</b>. This is the directory that contains
139
<b>tcl.h</b>. Then, in that same window, choose <i>Library
140
Files</i> under <i>Show directories for</i>. Add <b>d:/tcl/lib</b> (or
141
whatever directory contains <b>tcl83d.lib</b> in your distribution) to
142
the list. Now, select OK.
143
<p>In Visual C++ 6.0, select <i>Active Project Configuration</i> under
144
the <i>Build</i> pull-down menu. Choose <i>db_tcl -- Win32
145
Release</i>. To build, select <i>Build
146
libdb_tcl41.dll</i> under the <i>Build</i> pull-down
147
menu. This builds the Tcl support library for Berkeley DB, placing the result
148
into <b>build_win32/Release/libdb_tcl41.dll</b>.
149
Selecting an Active Configuration of <i>db_tcl -- Win32 Debug</i> will
150
build a debug version, placing the result into
151
<b>build_win32/Debug/libdb_tcl41d.dll</b>.
152
<p>In Visual C++ .NET, choose the build type (<i>Debug</i> or
153
<i>Release</i>) from the drop down list on the toolbar, then
154
right-click on <i>db_tcl</i> and choose <i>Build</i>.
155
<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/build_unix/ultrix.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/build_win/test.html"><img src="../../images/next.gif" alt="Next"></a>
157
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>