I'm puzzled by the implicit rule in apr_dbd.c that if one or more static dbd drivers are configured,
dso drivers aren't allowed. Also by the fact that dso dbd drivers need to be explicitly enabled.
Now that it works to have several different dbd drivers loaded, this seems
unnecessarily restrictive.
It makes more sense to me to always allow dso dbd drivers if the platform supports dso and the
driver name is not already in the 'drivers' hash. Static drivers would, of course, get in there
first and take precedence.
This patch to 1.3 works for me on Windows. I haven't tried it on Unix yet.
It dispenses with the whole --enable-dbd-dso/APU_DSO_BUILD thing and just enables dso dbd drivers if
dso is enabled - regardless of whether there are any static dbd drivers or not.
I hope I'm missing something here, or else I wish I brought this point up before all the work went
into changing the build. Alas, I just started looking at the dbd thing in the last few days.
-tom-
--- apr-util/dbd/apr_dbd.c_512324 2007-02-27 12:10:30.460285600 -0500
+++ apr-util/dbd/apr_dbd.c 2007-02-27 13:14:19.218906600 -0500
@@ -53,7 +53,6 @@
}
#endif
-#ifndef APU_DSO_BUILD
#define DRIVER_LOAD(name,driver,pool) \
{ \
extern const apr_dbd_driver_t driver; \
@@ -62,7 +61,6 @@
driver.init(pool); \
} \
}
-#endif
static apr_status_t apr_dbd_term(void *ptr)
{
@@ -92,7 +90,6 @@
/* This already registers a pool cleanup */
#endif
-#ifndef APU_DSO_BUILD
/* Load statically-linked drivers: */
#if APU_HAVE_MYSQL
DRIVER_LOAD("mysql", apr_dbd_mysql_driver, pool);
@@ -112,12 +109,11 @@
#if APU_HAVE_SOME_OTHER_BACKEND
DRIVER_LOAD("firebird", apr_dbd_other_driver, pool);
#endif
-#endif /* APU_DSO_BUILD */
return ret;
}
-#if defined(APU_DSO_BUILD) && APR_HAS_THREADS
+#if defined(APR_HAS_DSO) && APR_HAS_THREADS
#define dbd_drivers_lock(m) apr_thread_mutex_lock(m)
#define dbd_drivers_unlock(m) apr_thread_mutex_unlock(m)
#else
@@ -128,7 +124,7 @@
APU_DECLARE(apr_status_t) apr_dbd_get_driver(apr_pool_t *pool, const char
*name,
const apr_dbd_driver_t **driver)
{
-#ifdef APU_DSO_BUILD
+#ifdef APR_HAS_DSO
char path[80];
apr_dso_handle_t *dlhandle = NULL;
apr_dso_handle_sym_t symbol;
@@ -146,7 +142,7 @@
return APR_SUCCESS;
}
-#ifdef APU_DSO_BUILD
+#ifdef APR_HAS_DSO
#ifdef WIN32
sprintf(path, "apr_dbd_%s.dll", name);