Chapter 5. Building Berkeley DB for Windows Mobile
Prev |  | Next

## Chapter 5. Building Berkeley DB for Windows Mobile

## Building for Windows Mobile

This page contains general instructions on building Berkeley DB for Windows Mobile platforms using specific compilers.

The `build_wince` directory in the Berkeley DB distribution contains project files for Microsoft Visual 2005 with the Mobile SDK installed:

Project File | Description
--- | ---
Berkeley_DB.sln | Visual Studio 2005 solution
*.vcproj | Visual Studio 2005 project files

These project files can be used to build Berkeley DB for the Windows Mobile platform.

### Building Berkeley DB for Windows Mobile

#### Visual Studio 2005

1. Choose File -> Open Workspace.... Navigate to the `build_wince` directory, select `Berkeley_DB` and click `Open`.
2. Select the desired target platform from the platform drop-down menu.
3. Build the desired projects.

#### Build results

The results of your build will be placed in any one of the following Berkeley DB subdirectories, depending on the configuration that you chose:

`build_wince\(Platform)\Debug`
`build_wince\(Platform)\Release`
`build_wince\(Platform)\Debug_static`
`build_wince\(Platform)\Release_static`

When building your application during development, you must link against `libdb_small51sd.lib` or against `libdb_sql51sd.lib` for SQL features. You can also build using a release version of the Berkeley DB libraries and tools, which will be placed in the `build_wince\(Platform)\Release_static` directory. You must add the `build_wince` directory to the list of include directories of your application's project, or copy the Berkeley DB include files to a location in your Visual Studio include path.

### Changing Build Configuration Type

This section contains information on how to change between a dynamic library (.dll) and static library (.lib). The library projects and their default output and configuration in the Release build is as follows:

Project | Default Output | Default Configuration
--- | --- | ---
db_small_static | libdb_small51s.lib | Static Library
db_static | libdb51s.lib | Static Library
db_sql | libdb_sql51.dll | Dynamic Library
db_sql_static | libdb_sql51s.lib | Static Library

To change a project configuration type in Visual Studio 2005, select a project and do the following:

1. Choose Project->Properties and navigate to `Configuration Properties.`
2. Under `Project Defaults`, change the `Configuration Type` to your desired type.

Note: After this change, the output file names change to the Visual Studio 2005 defaults based on the project name.

### Building Berkeley DB for different target platforms

There are many possible target CPU architectures for a Windows Mobile application. This section outlines the process required to add a new target architecture to the project files supplied with Berkeley DB.

The Visual Studio 2005 project files will by default build for Pocket PC 2003 and Smartphone 2003, and Windows Mobile 6.5.3 Professional. If you want to build for other platforms such as Windows Mobile 6.0, 6.1, or 6.5, you need to follow the steps provided in this section.

Different target architectures are available in different Platform SDK or DTK downloads from Microsoft. The appropriate SDK must be installed for your mobile architecture before you can build for that platform. You can find the downloads at the Microsoft Developer Center page.

#### Visual Studio 2005

1. Choose File -> Open Workspace.... Navigate to the `build_wince` directory, select `Berkeley_DB` and click Open.
2. From the `Solution explorer` window, right-click the `Solution Berkeley_DB` and select `Configuration manager...`
3. In the `Active solution platform:` drop down box select `New...`
4. From the `Type or select the new platform` drop-down box, select a configuration from the ones available and click `OK.`
5. Click `Close` from the `Configuration Manager` dialog box.
6. The target platform drop-down now contains the platform just added.
7. Build as per the instructions given at the beginning of this chapter.

#### BDB SQL Notes

After building for a different platform, change the deployment remote directory for the `db_sql` project to run the `wce_sql` sample application:

1. Select `db_sql` from the `Solution explorer` window.
2. Choose Project->Properties and navigate to `Configuration Properties`.
3. Under `Deployment`, change the remote directory to `%CSIDL_PROGRAM_FILES%\wce_sql`.

Prev |  | Next
Windows FAQ | Home | Windows Mobile notes