<!--"@(#)intro.so 10.26 (Sleepycat) 11/18/99"--> <!--Copyright 1997-2003 by Sleepycat Software, Inc.--> <!--All rights reserved.--> <!--See the file LICENSE for redistribution information.--> <html> <head> <title>Berkeley DB Reference Guide: Building for Win32</title> <meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> <meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> </head> <body bgcolor=white> <a name="2"><!--meow--></a> <table width="100%"><tr valign=top> <td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Building Berkeley DB for Windows systems</dl></h3></td> <td align=right><a href="../build_unix/ultrix.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../build_win/small.html"><img src="../../images/next.gif" alt="Next"></a> </td></tr></table> <p> <h3 align=center>Building for Win32</h3> <p>The <b>build_win32</b> directory in the Berkeley DB distribution contains project files for Microsoft Visual C++:</p> <table border=1 align=center> <tr><th>Project File</th><th>Description</th></tr> <tr> <td align=center>Berkeley_DB.dsw</td> <td align=center>Visual C++ 6.0 workspace</td> </tr> <tr> <td align=center>*.dsp</td> <td align=center>Visual C++ 6.0 projects</td> </tr> </table> <p>These project files can be used to build Berkeley DB for any Win32 platform: Windows/XP, Windows/2000, Windows/NT, Windows/98 and Windows/95.</p> <h3>Building Berkeley DB with Visual C++ .NET</h3> <ol> <p><li>Choose <i>File -> Open Solution</i>. Look in the <b>build_win32</b> directory for compatible workspace files, select <b>Berkeley_DB.dsw</b>, and press Open. <p><li>You will be prompted to convert the project files to Visual C++ 7.0 project format. Select "Yes to All". <p><li>Set your include directories. Choose <i>Tools -> Options -> Projects -> VC++ Directories</i>. Under the "Show directories for" pulldown, select "Include files". Add the full pathnames for the <b>build_win32</b> subdirectory of Berkeley DB. Then click OK. <p><li>Choose the project configuration from the drop-down menu on the .NET tool bar (Debug, Release, Debug Static or Release Static). <p><li>To build, right-click on build_all and select Build. The results of your build will be placed in a subdirectory of <b>build_win32</b> named after the configuration you chose (for examples, <b>build_win32/Release</b> or <b>build_win32/Debug</b>). </ol> <h3>Building Berkeley DB with Visual C++ 6.0</h3> <ol> <p><li>Choose <i>File -> Open Workspace</i>. Look in the <b>build_win32</b> directory for Workspaces, select <b>Berkeley_DB.dsw</b>, and press Open. <p><li>Set your include directories. <i>Choose Tools -> Options -> Directories</i>. Under the "Show directories for" pulldown, select "Include files". Add the full pathnames for the <b>build_win32</b> subdirectory of Berkeley DB. Then click OK. <p><li>Choose the desired project configuration by going to <i>Build -> Set Active Configuration</i> and select the appropriate option to the build_all project (Debug, Release, Debug Static or Release Static). Then click OK. <p><li>To build, select <i>Build -> Build build_all.exe</i>. The results of your build will be placed in a subdirectory of <b>build_win32</b> named after the configuration you chose (for examples, <b>build_win32/Release</b> or <b>build_win32/Debug</b>). </ol> <p>When building your application, you should normally use compile options "Debug Multithreaded DLL" and link against <b>build_win32/Debug/libdb42d.lib</b>. If you want to link against a static (non-DLL) version of the library, use the "Debug Multithreaded" compile options and link against <b>build_win32/Debug_static/libdb42sd.lib</b>. You can also build using a release version of the libraries and tools, which will be placed in <b>build_win32/Release/libdb42.lib</b>. The static version will be in <b>build_win32/Release_static/libdb42s.lib</b>. You will also need to add the <b>build_win32</b> directory to the list of include directories of your application's project.</p> <p>Each release of Berkeley DB is built and tested with this procedure using Microsoft Visual C++ 6.0, Standard Version and Microsoft Visual C++ .NET, Standard Version.</p> <h3>Building Berkeley DB with Cygwin</h3> <p>To build Berkeley DB with Cygwin, follow the instructions in <a href="../../ref/build_unix/intro.html">Building for UNIX</a>.</p> <h3>Building the C++ API</h3> <p>C++ support is built automatically on Win32.</p> <h3>Building the Java API</h3> <p>Java support is not built automatically. The following instructions assume that you have installed the Sun Java Development Kit in <b>d:/java</b>. Of course, if you installed elsewhere or have different Java software, you will need to adjust the pathnames accordingly.</p> <h4>Building Java with Visual C++ .NET</h4> <ol> <p><li>Set your include directories. Choose <i>Tools -> Options -> Projects -> VC++ Directories</i>. Under the "Show directories for" pulldown, select "Include files". Add the full pathnames for the <b>java/include</b> and <b>java/include/win32</b> directories. Then click OK. These are the directories needed when including jni.h. <p><li>Set the executable files directories. Choose <i>Tools -> Options -> Projects -> VC++ Directories</i>. Under the "Show directories for" pulldown, select "Executable files". Add the full pathname for the <b>java/bin</b> directory, then click OK. This is the directory needed to find javac. <p><li>Set the build type to Release or Debug in the drop-down on the .NET tool bar. <p><li>To build, right-click on db_java and select Build. This builds the Java support library for Berkeley DB and compiles all the java files, placing the resulting <b>db.jar</b> and <b>dbexamples.jar</b> files in the <b>build_win32/Release</b> or <b>build_win32/Debug</b> subdirectory of Berkeley DB. </ol> <h4>Building Java with Visual C++ 6.0</h4> <ol> <p><li>Set the include directories. Choose <i>Tools -> Options -> Directories</i>. Under the "Show directories for" pulldown, select "Include files". Add the full pathnames for the <b>java/include</b> and <b>java/include/win32</b> directories. These are the directories needed when including <b>jni.h</b>. <p><li>Set the executable files directories. Choose <i>Tools -> Options -> Directories</i>. Under the "Show directories for" pulldown, select "Executable files". Add the full pathname for the <b>java/bin</b> directory. This is the directory needed to find javac. <p><li>Go to <i>Build -> Set Active Configuration</i> and select either the Debug or Release version of the db_java project. Then press OK. <p><li>To build, select <i>Build -> Build libdb_java42.dll</i>. This builds the Java support library for Berkeley DB and compiles all the java files, placing the resulting <b>db.jar</b> and <b>dbexamples.jar</b> files in the <b>build_win32/Release</b> or <b>build_win32/Debug</b> subdirectory of Berkeley DB. </ol> <p>To run Java code, set your environment variable <b>CLASSPATH</b> to include the full pathname of these jar files, and your environment variable <b>PATH</b> to include the <b>build_win32/Release</b> subdirectory. On Windows, remember that files or directories in the <b>CLASSPATH</b> and <b>PATH</b> variables must be separated by semicolons (unlike UNIX). Then, try running the following command as a test:</p> <blockquote><pre>java com.sleepycat.examples.db.AccessExample</pre></blockquote> <p>If you want to run Java code using a Debug build, substitute 'Debug' for 'Release' in the instructions above. Make sure you use the Debug JAR file with the Debug DLL and the Release JAR with the Release DLL.</p> <h3>Building the Tcl API</h3> <p>Tcl support is not built automatically. See <a href="../../ref/tcl/intro.html">Loading Berkeley DB with Tcl</a> for information on sites from which you can download Tcl and which Tcl versions are compatible with Berkeley DB. These notes assume that Tcl is installed as <b>d:/tcl</b>, but you can change that if you want.</p> <p>The Tcl library must be built as the same build type as the Berkeley DB library (both Release or both Debug). We found that the binary release of Tcl can be used with the Release configuration of Berkeley DB, but you will need to build Tcl from sources for the Debug configuration. Before building Tcl, you will need to modify its makefile to make sure that you are building a debug version, including thread support. This is because the set of DLLs linked into the Tcl executable must match the corresponding set of DLLs used by Berkeley DB.</p> <h4>Building Tcl with Visual C++ .NET</h4> <ol> <p><li>Set the include directories. Choose <i>Tools -> Options -> Projects -> VC++ Directories</i>. Under the "Show directories for" pulldown, select "Include files". Add the full pathname for <b>tcl/include</b>, then click OK. This is the directory that contains <b>tcl.h</b>. <p><li>Set the library files directory. Choose <i>Tools -> Options -> Projects -> VC++ Directories</i>. Under the "Show directories for" pulldown, select "Library files". Add the full pathname for the <b>tcl/lib</b> directory, then click OK. This is the directory needed to find <b>tcl84g.lib</b> (or whatever the library is named in your distribution). <p><li>Set the build type to Release or Debug in the drop-down on the .NET tool bar. <p><li>To build, right-click on db_tcl and select Build. This builds the Tcl support library for Berkeley DB, placing the result into <b>build_win32/Debug/libdb_tcl4M4MINORd.dll</b> or <b>build_win32/Release/libdb_tcl42.dll</b>. </ol> <p>If you use a version different from Tcl 8.4.x you will need to change the name of the Tcl library used in the build (for example, <b>tcl84g.lib</b>) to the appropriate name. To do this, right click on <i>db_tcl</i>, go to <i>Properties -> Linker -> Input -> Additional dependencies</i> and change <b>tcl84g.lib</b> to match the Tcl version you are using.</p> <h4>Building Tcl with Visual C++ 6.0</h4> <ol> <p><li>Set the include directories. Choose <i>Tools -> Options -> Directories</i>. Under the "Show directories for" pulldown, select "Include files". Add the full pathname for <b>tcl/include</b>, then click OK. This is the directory that contains <b>tcl.h</b>. <p><li>Set the library files directory. Choose <i>Tools -> Options -> Directories</i>. Under the "Show directories for" pulldown, select "Library files". Add the full pathname for the <b>tcl/lib</b> directory, then click OK. This is the directory needed to find <b>tcl84g.lib</b> (or whatever the library is named in your distribution). <p><li>Go to <i>Build -> Set Active Configuration</i> and select either the Debug or Release version of the db_tcl project. Then press OK. <p><li>To build, select <i>Build -> Build libdb_tcl42.dll</i>. This builds the Tcl support library for Berkeley DB, placing the result into <b>build_win32/Debug/libdb_tcl4M4MINORd.dll</b> or <b>build_win32/Release/libdb_tcl42.dll</b>. </ol> <p>If you use a version different from Tcl 8.4.x you will need to change the name of the Tcl library used in the build (for example, <b>tcl84g.lib</b>) to the appropriate name. To do this, right click on <i>db_tcl</i>, go to <i>Settings -> Link -> Object / library modules</i> and change <b>tcl84g.lib</b> to match the Tcl version you are using.</p> <h3>Distributing DLLs</h3> <p>When distributing applications linked against the DLL (not static) version of the library, the DLL files you need will be found in the <b>build_win32/Release</b> subdirectory, or <b>build_win32/Debug</b> if you distribute a debug version. You may also need to redistribute DLL files needed for the compiler's runtime. For Visual C++ 6.0, these files are <b>msvcrt.dll</b> and <b>msvcp60.dll</b> if you built with a Release configuration, or <b>msvcrtd.dll</b> and <b>msvcp60d.dll</b> if you are using a Debug configuration. Generally, these runtime DLL files can be installed in the same directory that will contain your installed Berkeley DB DLLs. This directory may need to be added to your System PATH environment variable. Check your compiler's license and documentation for specifics on redistributing runtime DLLs.</p> <table width="100%"><tr><td><br></td><td align=right><a href="../build_unix/ultrix.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../build_win/small.html"><img src="../../images/next.gif" alt="Next"></a> </td></tr></table> <p><font size=1><a href="../../sleepycat/legal.html">Copyright (c) 1996-2003</a> <a href="http://www.sleepycat.com">Sleepycat Software, Inc.</a> - All rights reserved.</font> </body> </html>