###

Berkeley DB Reference Guide:
  Building Berkeley DB for Win32 platforms

# Building for Win32

The build_win32 directory in the Berkeley DB distribution contains project files for both MSVC 5.0 and 6.0:

Project File | Description
--- | ---
Berkeley_DB.dsw | Visual C++ 5.0 project (compatible with 6.0)
*.dsp | Visual C++ 5.0 subprojects (compatible with 6.0 )

These project files can be used to build Berkeley DB for any Win32 platform: Windows 2000, Windows NT, Windows 98 and Windows 95.

### Building With Visual C++ 6.0

Open the file Berkeley_DB.dsw. You will be told that the project was generated by a previous version of Developer Studio, and asked if you want to convert the project. Select Yes, and all projects will be converted. Then continue on with the instructions for building with Visual C++ 5.0.

Note that when you build a release version, you may receive a warning about an unknown compiler option /Ob2. This is apparently a flaw in the project conversion for Visual C++ and can be ignored.

Each release of Berkeley DB is built and tested with this procedure using Microsoft Visual C++ 6.0, Standard Edition.

### Building With Visual C++ 5.0

Open the file Berkeley_DB.dsw. This workspace includes a number of subprojects needed to build Berkeley DB.

First, you'll need to set the include directories. To do this, select Options... from the Tools pull-down menu. At this point, a tabbed dialogue should appear. In this new window, choose the Directories tab. For the Platform, select Win32 and for Show directories for select Include files. Below these options in the list of directories, you should add two directories: the full pathname of the build_win32 subdirectory of Berkeley DB, followed by the full pathname of the include subdirectory of Berkeley DB. Then click OK.

Then, select Active Project Configuration under the Build pull-down menu. For a debug version of the libraries, tools and examples, select db_buildall - Win32 Debug. Results from this build are put into build_win32/Debug. For a release version, select db_buildall - Win32 Release; results are put into build_win32/Release. For a debug version that has all tools and examples built with static libraries, select db_buildall - Win32 Debug Static; results are put into build_win32/Debug_static. For a release version of the same, select db_buildall - Win32 Release Static; results are put into build_win32/Release_static. Finally, to build, select Build db_buildall.exe under the Build pull-down menu.

When building your application, you should normally use compile options "debug multithreaded dll" and link against build_win32/Debug/libdb32d.lib. If you want to link against a static (non-DLL) version of the library, use the "debug multithreaded" compile options and link against build_win32/Debug_static/libdb32sd.lib. You can also build using a release version of the libraries and tools, which will be placed in build_win32/Release/libdb32.lib. The static version will be in build_win32/Release_static/libdb32s.lib.

Each release of Berkeley DB is maintained, built and tested using Microsoft Visual C++ 5.0 and 6.0.

### Including the C++ API

C++ support is built automatically on Win32.

### Including the Java API

Java support is not built automatically. The following instructions assume you have installed the Sun Java Development Kit in d:/java. Of course, if you've installed elsewhere, or have different Java software, you will need to adjust the pathnames accordingly. First, use the instructions above for Visual C++ 5.0 or 6.0 to open the Tools/Options tabbed dialog for adding include directories. In addition to the directories specified above, add d:/java/include and d:/java/include/win32. These are the directories needed when including jni.h. Now, before clicking OK, under Show directories for, choose Executable files. Add d:/java/bin. That directory is needed to find javac. Now select OK.

Select Active Project Configuration under the Build pull-down menu. Choose db_java - Win32 Release. To build, select Build libdb_java32.dll under the Build pull-down menu. This builds the Java support library for Berkeley DB and compiles all the java files, placing the class files in the java/classes subdirectory of Berkeley DB. Set your environment variable CLASSPATH to include this directory, your environment variable PATH to include the build_win32/Release subdirectory, and as a test, try running the command:

>     java com.sleepycat.examples.AccessExample

### Including the Tcl API

Tcl support is not built automatically. See Loading Berkeley DB with Tcl for information on sites from which you can download Tcl and which Tcl versions are compatible with Berkeley DB.

The Tcl library must be built as the same build type as the Berkeley DB library (both Release or both Debug). We have found that the binary release of Tcl can be used with the Release configuration of Berkeley DB, but for the Debug configuration, you will need to need to build Tcl from sources. Before building Tcl, you will need to modify its makefile to make sure 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.

These notes assume Tcl is installed as d:/tcl, but you can change that if you wish. If you run using a different version of Tcl than the one currently being used by Sleepycat Software, you will need to change the name of the Tcl library used in the build (e.g., tcl83d.lib) to the appropriate name. See Projects->Settings->Link in the db_tcl subproject.

Use the instructions above for Visual C++ 5.0 or 6.0 to open the Tools/Options tabbed dialog for adding include directories. In addition to the directories specified above, add d:/tcl/include. This is the directory that contains tcl.h. Then, in that same dialog, show directories for "Library Files". Add d:/tcl/lib (or whatever directory contains tcl83d.lib in your distribution) to the list. Now select OK.

Select Active Project Configuration under the Build pull-down menu. Choose db_tcl - Win32 Release. To build, select Build libdb_tcl32.dll under the Build pull-down menu. This builds the Tcl support library for Berkeley DB, placing the result into build_win32/Release/libdb_tcl32.dll. Selecting an Active Configuration of db_tcl - Win32 Debug will build a debug version, placing the result into build_win32/Debug/libdb_tcl32d.dll.

Copyright Sleepycat Software