Berkeley DB Reference Guide: Building Berkeley DB for Win32 platforms
Description: Berkeley DB: An embedded database programmatic toolkit.
Keywords: embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++

### Berkeley DB Reference Guide: Building Berkeley DB for Win32 platforms |

# Building for Win32 platforms

The build_win32 directory in the Berkeley DB distribution contains project files for both MSVC4.X and 5.0:

Project File | Description
--- | ---
DB_VC4.mdp | Visual C++ 4.0 project file
DB_VC4.mak | Makefile exported by Visual C++ 4.0.
Berkeley_DB.dsw | Visual C++ 5.0 project file
*.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/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. For a release version, select db_buildall - Win32 Release. 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/libdb30d.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/libdb30sd.lib. You can also build a release version of the libraries and tools, which will be placed in build_win32/Release/libdb30.lib. The static version will be in build_win32/Release/libdb30s.lib.

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

### Building With Visual C++ 4.x

First move your distribution directory to \db (so that the project file is \db\build_win32\DB_VC4.mdp for some drive letter). Then open the file DB_VC4.mdp. The 4.X project files currently allow you to build only the DLL version of libdb. 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: /db/build_win32 followed by the /db/include directory, and select OK. You can now build the DLL.

### 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_java30.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. The following instructions assume you have installed Tcl8.x in d:/tcl. Of course, if you've installed Tcl elsewhere, or have different 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:/tcl/include. This is the directory that contains tcl.h. Now select OK.

Select Active Project Configuration under the Build pull-down menu. Choose db_tcl - Win32 Release. To build, select Build libdb_tcl30.dll under the Build pull-down menu. This builds the Tcl support library for Berkeley DB, placing the result into build_win32/Release/libdb_tcl30.dll.

Copyright Sleepycat Software