Building for Win32
The build_win32 directory in the Berkeley DB distribution contains project files for both MSVC 5.0 and 6.0:
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.
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 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 dialog 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, you should add two directories to the list of 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/libdb40d.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/libdb40sd.lib. You can also build using a release version of the libraries and tools, which will be placed in build_win32/Release/libdb40.lib. The static version will be in build_win32/Release_static/libdb40s.lib.
Each release of Berkeley DB is 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 that you have installed the Sun Java Development Kit in d:/java. Of course, if you installed elsewhere or have different Java software, you will need to adjust the pathnames accordingly. First, use the previous instructions 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 previously, add d:/java/include and d:/java/include/win32. These are the directories needed when including jni.h. Now, before clicking OK, choose Executable files under Show directories for. 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_java40.dll under the Build pull-down menu. This builds the Java support library for Berkeley DB and compiles all the java files, placing the resulting db.jar and dbexamples.jar files in the build_win32/Release subdirectory of Berkeley DB. Set your environment variable CLASSPATH to include the full pathname of these jar files, and your environment variable PATH to include the build_win32/Release subdirectory. On Windows, remember that files or directories in the CLASSPATH and PATH variables must be separated by semicolons (unlike UNIX). Then, try running the following command as a test:
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 found that the binary release of Tcl can be used with the Release configuration of Berkeley DB, but you will need to 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.
These notes assume that Tcl is installed as d:/tcl, but you can change that if you want. If you run using a version of Tcl different from the one currently being used by Sleepycat Software, you will need to change the name of the Tcl library used in the build (for example, tcl83d.lib) to the appropriate name. See Projects->Settings->Link in the db_tcl subproject.
Use the previous instructions 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 previously, 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_tcl40.dll under the Build pull-down menu. This builds the Tcl support library for Berkeley DB, placing the result into build_win32/Release/libdb_tcl40.dll. Selecting an Active Configuration of db_tcl -- Win32 Debug will build a debug version, placing the result into build_win32/Debug/libdb_tcl40d.dll.