Next: , Previous: , Up: Top   [Contents][Index]


23 Compatibility with standard dbm and ndbm

Gdbm includes a compatibility layer, which provides traditional ndbm and older dbm functions. The layer is compiled and installed if the --enable-libgdbm-compat option is used when configuring the package.

The compatibility layer consists of two header files: ndbm.h and dbm.h and the libgdbm_compat library.

Older programs using ndbm or dbm interfaces can use libgdbm_compat without any changes. To link a program with the compatibility library, add the following two options to the cc invocation: -lgdbm -lgdbm_compat. The -L option may also be required, depending on where GDBM is installed, e.g.:

cc ... -lgdbm -lgdbm_compat

Databases created and manipulated by the compatibility interfaces consist of two different files: file.dir and file.pag. This is required by the POSIX specification and corresponds to the traditional usage. Note, however, that despite the similarity of the naming convention, actual data stored in these files has not the same format as in the databases created by other dbm or ndbm libraries. In other words, you cannot access a standard UNIX dbm file with GNU dbm!

Compatibility interface includes only functions required by POSIX (see ndbm) or present in the traditional DBM implementation (see dbm). Advanced GDBM features, such as crash tolerance, cannot be used with such databases.

GNU dbm files are not sparse. You can copy them with the usual cp command and they will not expand in the copying process.


Next: , Previous: , Up: Top   [Contents][Index]