-Datum ldbm_firstkey( LDBM ldbm );
-Datum ldbm_nextkey( LDBM ldbm, Datum key );
-int ldbm_errno( LDBM ldbm );
+
+#if HAVE_BERKELEY_DB2
+ void *ldbm_malloc( size_t size );
+ Datum ldbm_firstkey( LDBM ldbm, DBC **dbch );
+ Datum ldbm_nextkey( LDBM ldbm, Datum key, DBC *dbcp );
+#else
+ Datum ldbm_firstkey( LDBM ldbm );
+ Datum ldbm_nextkey( LDBM ldbm, Datum key );
+#endif
+
+
+/* initialization of Datum structures */
+#ifdef HAVE_BERKELEY_DB2
+# define ldbm_datum_init(d) ((void)memset(&(d), 0, sizeof(Datum)))
+#else
+# define ldbm_datum_init(d) ((void)0)
+#endif /* HAVE_BERKELEY_DB2 */
+
+LDAP_END_DECL