Berkeley DB Reference Guide: Windows FAQ
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 Windows systems |

### Windows FAQ

1. Why do I have db_load.dll - where is db_load.exe?

   Microsoft Visual C++ .NET has some bugs related to converting project files from VC++ 6.0 format and incorrectly converts the db_load project. For more information, see Microsoft's article about this bug.

   The workaround is simply to switch the db_load project back to generating an EXE after converting to VC++ .NET. To do this, right click on db_load -> Properties and change "Configuration Type" from "Dynamic Library (.dll)" to "Application (.exe)".

2. My Win* C/C++ application crashes in the Berkeley DB library when Berkeley DB calls fprintf (or some other standard C library function).

   You should be using the "Debug Multithreaded DLL" compiler option in your application when you link with the build_win32/Debug/libdb42d.lib library (this .lib file is actually a stub for libdb42d.DLL). To check this setting in Visual C++, choose the Project/Settings menu item and select Code Generation under the tab marked C/C++; and see the box marked Use runtime library. This should be set to Debug Multithreaded DLL. If your application is linked against the static library, build_win32/Debug/libdb42sd.lib; then, you will want to set Use runtime library to Debug Multithreaded.

   Setting this option incorrectly can cause multiple versions of the standard libraries to be linked into your application (one on behalf of your application, and one on behalf of the Berkeley DB library). That violates assumptions made by these libraries, and traps can result.

3. Why are the build options for DB_DLL marked as "Use MFC in a Shared DLL"? Does Berkeley DB use MFC?

   Berkeley DB does not use MFC at all. It does however, call malloc and free and other facilities provided by the Microsoft C runtime library. We found in our work that many applications and libraries are built assuming MFC, and specifying this for Berkeley DB solves various interoperation issues, and guarantees that the right runtime libraries are selected. Note that because we do not use MFC facilities, the MFC library DLL is not marked as a dependency for libdb.dll, but the appropriate Microsoft C runtime is.

4. How do I enable diagnostic mode on Windows?

   You will need to edit build_win32/db_config.h and change this line:

   >     /* #undef HAVE_DIAGNOSTIC */

   to this:

   >     #define HAVE_DIAGNOSTIC 1

   Then add this line to the end of build_win32/libdb.def:

   >     __db_assert     @123

   Change the '123' above to the last entry in the file plus one.

5. How can I build Berkeley DB for MinGW?

   Follow the instructions in Building for UNIX/POSIX, and specify the --enable-mingw option to the configuration script. This configuration option currently only builds static versions of the library, it does not yet build a DLL version of the library.

6. The test suite hangs under Windows.

   There are bugs in some versions of Tcl that may cause the test suite to hang on Windows (specifically, we've seen hangs on Windows/NT 4.0). If you want to run the test suite against a Debug version of Berkeley DB, you need to build a Debug version of Tcl, which requires building Tcl from source.

Copyright (c) 1996-2003 Sleepycat Software, Inc. - All rights reserved.