| 1 |
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| 2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 6 |
<title>Windows FAQ</title> |
| 7 |
<link rel="stylesheet" href="gettingStarted.css" type="text/css" /> |
| 8 |
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> |
| 9 |
<link rel="start" href="index.html" title="Berkeley DB Installation and Build Guide" /> |
| 10 |
<link rel="up" href="build_win.html" title="Chapter 5. Building Berkeley DB for Windows" /> |
| 11 |
<link rel="prev" href="build_win_notes.html" title="Windows notes" /> |
| 12 |
<link rel="next" href="build_wince.html" title="Chapter 6. Building Berkeley DB for Windows Mobile" /> |
| 13 |
</head> |
| 14 |
<body> |
| 15 |
<div xmlns="" class="navheader"> |
| 16 |
<div class="libver"> |
| 17 |
<p>Library Version 11.2.5.3</p> |
| 18 |
</div> |
| 19 |
<table width="100%" summary="Navigation header"> |
| 20 |
<tr> |
| 21 |
<th colspan="3" align="center">Windows FAQ</th> |
| 22 |
</tr> |
| 23 |
<tr> |
| 24 |
<td width="20%" align="left"><a accesskey="p" href="build_win_notes.html">Prev</a> </td> |
| 25 |
<th width="60%" align="center">Chapter 5. |
| 26 |
Building Berkeley DB for Windows |
| 27 |
</th> |
| 28 |
<td width="20%" align="right"> <a accesskey="n" href="build_wince.html">Next</a></td> |
| 29 |
</tr> |
| 30 |
</table> |
| 31 |
<hr /> |
| 32 |
</div> |
| 33 |
<div class="sect1" lang="en" xml:lang="en"> |
| 34 |
<div class="titlepage"> |
| 35 |
<div> |
| 36 |
<div> |
| 37 |
<h2 class="title" style="clear: both"><a id="build_win_faq"></a>Windows FAQ</h2> |
| 38 |
</div> |
| 39 |
</div> |
| 40 |
</div> |
| 41 |
<div class="orderedlist"> |
| 42 |
<ol type="1"> |
| 43 |
<li> |
| 44 |
<span class="bold"> |
| 45 |
<strong>My Win* C/C++ application crashes in the Berkeley DB library when Berkeley DB calls |
| 46 |
fprintf (or some other standard C library function).</strong> |
| 47 |
</span> |
| 48 |
<p>You should be using the "Debug Multithreaded DLL" compiler option in |
| 49 |
your application when you link with the |
| 50 |
build_windows\Debug\libdb48d.lib library (this .lib file |
| 51 |
is actually a stub for libdb48d.DLL). To check this |
| 52 |
setting in Visual C++, choose the <span class="emphasis"><em>Project/Settings</em></span> menu |
| 53 |
item and select <span class="emphasis"><em>Code Generation</em></span> under the tab marked |
| 54 |
<span class="emphasis"><em>C/C++</em></span>; and see the box marked <span class="emphasis"><em>Use runtime |
| 55 |
library</em></span>. This should be set to <span class="emphasis"><em>Debug Multithreaded DLL</em></span>. |
| 56 |
If your application is linked against the static library, |
| 57 |
build_windows\Debug\libdb48sd.lib; then, you will want |
| 58 |
to set <span class="emphasis"><em>Use runtime library</em></span> to <span class="emphasis"><em>Debug Multithreaded</em></span>.</p> |
| 59 |
<p>Setting this option incorrectly can cause multiple versions of the |
| 60 |
standard libraries to be linked into your application (one on behalf |
| 61 |
of your application, and one on behalf of the Berkeley DB library). That |
| 62 |
violates assumptions made by these libraries, and traps can result.</p> |
| 63 |
<p> |
| 64 |
Also, using different Visual Studio compilers in the application and |
| 65 |
libraries can lead to a crash. So rebuild the application |
| 66 |
with the same Visual C++ version as that of the library. |
| 67 |
</p> |
| 68 |
</li> |
| 69 |
<li> |
| 70 |
<span class="bold"> |
| 71 |
<strong>Why are the build options for DB_DLL marked as "Use MFC in a Shared DLL"? |
| 72 |
Does Berkeley DB use MFC?</strong> |
| 73 |
</span> |
| 74 |
<p>Berkeley DB does not use MFC at all. It does however, call malloc and free |
| 75 |
and other facilities provided by the Microsoft C runtime library. We |
| 76 |
found in our work that many applications and libraries are built |
| 77 |
assuming MFC, and specifying this for Berkeley DB solves various |
| 78 |
interoperation issues, and guarantees that the right runtime libraries |
| 79 |
are selected. Note that because we do not use MFC facilities, the MFC |
| 80 |
library DLL is not marked as a dependency for libdb.dll, but the |
| 81 |
appropriate Microsoft C runtime is.</p> |
| 82 |
</li> |
| 83 |
<li> |
| 84 |
<span class="bold"> |
| 85 |
<strong>How can I build Berkeley DB for <a class="ulink" href="http://www.mingw.org" target="_top">MinGW</a>?</strong> |
| 86 |
</span> |
| 87 |
<p>Follow the instructions in <a class="xref" href="build_unix.html#build_unix_intro" title="Building for UNIX/POSIX">Building for UNIX/POSIX</a>, and specify the --enable-mingw option to the |
| 88 |
configuration script. This configuration option currently only builds |
| 89 |
static versions of the library, it does not yet build a DLL version of |
| 90 |
the library, and file sizes are limited to 2GB (2^32 bytes.)</p> |
| 91 |
</li> |
| 92 |
<li> |
| 93 |
<span class="bold"> |
| 94 |
<strong>How can I build a Berkeley DB for Windows 98/ME?</strong> |
| 95 |
</span> |
| 96 |
<p> |
| 97 |
Windows 98/ME is no longer supported by Berkeley DB. The following is |
| 98 |
therefore only of interest to historical users of Berkeley DB. |
| 99 |
</p> |
| 100 |
<p> |
| 101 |
By default on Windows, Berkeley DB supports internationalized |
| 102 |
filenames by treating all directory paths and filenames passed to |
| 103 |
Berkeley DB methods as UTF-8 encoded strings. All paths are |
| 104 |
internally converted to wide character strings and passed to the |
| 105 |
wide character variants of Windows system calls. |
| 106 |
</p> |
| 107 |
<p> |
| 108 |
This allows applications to create and open databases with names |
| 109 |
that cannot be represented with ASCII names while maintaining |
| 110 |
compatibility with applications that work purely with ASCII paths. |
| 111 |
</p> |
| 112 |
<p> |
| 113 |
Windows 98 and ME do not support Unicode paths directly. To build for |
| 114 |
those versions of Windows, either: |
| 115 |
</p> |
| 116 |
<div class="itemizedlist"> |
| 117 |
<ul type="disc"> |
| 118 |
<li> |
| 119 |
<p> |
| 120 |
Follow the instructions at |
| 121 |
<a class="ulink" href="http://msdn.microsoft.com/en-us/goglobal/bb688166.aspx" target="_top">Microsoft's web site</a>. |
| 122 |
</p> |
| 123 |
</li> |
| 124 |
<li> |
| 125 |
<p>Open the workspace or solution file with Visual Studio. Then |
| 126 |
open the Project properties/settings section for the project you need to build |
| 127 |
(at least db_dll). In the <span class="emphasis"><em>C/C++->Preprocessor->Preprocessor |
| 128 |
Definitions</em></span> section, remove <span class="emphasis"><em>_UNICODE</em></span> and |
| 129 |
<span class="emphasis"><em>UNICODE</em></span> entries. Add in an entry of |
| 130 |
<span class="emphasis"><em>_MBCS</em></span>. Build the project as normal.</p> |
| 131 |
</li> |
| 132 |
</ul> |
| 133 |
</div> |
| 134 |
<p>The ASCII builds will also work on Windows NT/2K/XP/2003 and Windows7, but will |
| 135 |
not translate paths to wide character strings.</p> |
| 136 |
</li> |
| 137 |
</ol> |
| 138 |
</div> |
| 139 |
</div> |
| 140 |
<div class="navfooter"> |
| 141 |
<hr /> |
| 142 |
<table width="100%" summary="Navigation footer"> |
| 143 |
<tr> |
| 144 |
<td width="40%" align="left"><a accesskey="p" href="build_win_notes.html">Prev</a> </td> |
| 145 |
<td width="20%" align="center"> |
| 146 |
<a accesskey="u" href="build_win.html">Up</a> |
| 147 |
</td> |
| 148 |
<td width="40%" align="right"> <a accesskey="n" href="build_wince.html">Next</a></td> |
| 149 |
</tr> |
| 150 |
<tr> |
| 151 |
<td width="40%" align="left" valign="top">Windows notes </td> |
| 152 |
<td width="20%" align="center"> |
| 153 |
<a accesskey="h" href="index.html">Home</a> |
| 154 |
</td> |
| 155 |
<td width="40%" align="right" valign="top"> Chapter 6. |
| 156 |
Building Berkeley DB for Windows Mobile |
| 157 |
</td> |
| 158 |
</tr> |
| 159 |
</table> |
| 160 |
</div> |
| 161 |
</body> |
| 162 |
</html> |