Building the Tcl API
Prev | Chapter 28. Building Berkeley DB for Windows | Next

## Building 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. These notes assume that Tcl is installed as `d:\tcl`, but you can change that if you want.

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 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.

### Building Tcl with Visual C++ .NET or above

1. Set the include directories. Choose Tools -> Options -> Projects -> VC++ Directories. Under the "Show directories for" pull-down, select "Include files". Add the full pathname for `d:\tcl\include`, then click OK. This is the directory that contains `tcl.h`.
2. Set the library files directory. Choose Tools -> Options -> Projects -> VC++ Directories. Under the "Show directories for" pull-down, select "Library files". Add the full pathname for the `d:\tcl\lib` directory, then click OK. This is the directory needed to find `tcl84g.lib` (or whatever the library is named in your distribution).
3. Set the build type to Release or Debug in the drop-down on the tool bar.

4. To build, right-click on db_tcl and select Build. This builds the Tcl support library for Berkeley DB, placing the result into one of the following Berkeley DB subdirectories, depending upon the configuration that you chose:

   `build_windows\Win32\Debug\libdb_tcl48d.dll`
   `build_windows\Win32\Release\libdb_tcl48.dll`

If you use a version different from Tcl 8.4.x you will need to change the name of the Tcl library used in the build (for example, `tcl84g.lib`) to the appropriate name. To do this, right click on db_tcl, go to Properties -> Linker -> Input -> Additional dependencies and change `tcl84g.lib` to match the Tcl version you are using.

### Building Tcl with Visual C++ 6.0

1. Set the include directories. Choose Tools -> Options -> Directories. Under the "Show directories for" pull-down, select "Include files". Add the full pathname for `d:\tcl\include`, then click OK. This is the directory that contains `tcl.h`.
2. Set the library files directory. Choose Tools -> Options -> Directories. Under the "Show directories for" pull-down, select "Library files". Add the full pathname for the `d:\tcl\lib` directory, then click OK. This is the directory needed to find `tcl84g.lib` (or whatever the library is named in your distribution).
3. Go to Build -> Set Active Configuration and select either the Debug or Release version of the db_tcl project. Then press OK.

4. To build, select Build -> Build libdb_tcl48.dll. This builds the Tcl support library for Berkeley DB, placing the result into one of the following Berkeley DB subdirectories, depending upon the configuration that you chose:

   `build_windows\Win32\Debug\libdb_tcl48d.dll`
   `build_windows\Win32\Release\libdb_tcl48.dll`

If you use a version different from Tcl 8.4.x you will need to change the name of the Tcl library used in the build (for example, `tcl84g.lib`) to the appropriate name. To do this, choose Project -> Settings -> db_tcl and change the Tcl library listed in the Object/Library modules `tcl84g.lib` to match the Tcl version you are using.

Prev | Up | Next
Building the C# API | Home | Distributing DLLs