提交 8b9d017d 编写于 作者: D Daniel P. Berrange

driver: conditionalize use of dlopen functions & use mingw-dlfcn

Not every platform is guaranteed to have dlopen/dlsym, so we should
conditionalize its use. Suprisingly it is actually present for Win32
via the mingw-dlfcn add on, but we should still conditionalize it.
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 376cfc2a
...@@ -54,6 +54,8 @@ BuildRequires: mingw32-libxml2 ...@@ -54,6 +54,8 @@ BuildRequires: mingw32-libxml2
BuildRequires: mingw64-libxml2 BuildRequires: mingw64-libxml2
BuildRequires: mingw32-portablexdr BuildRequires: mingw32-portablexdr
BuildRequires: mingw64-portablexdr BuildRequires: mingw64-portablexdr
BuildRequires: mingw32-dlfcn
BuildRequires: mingw64-dlfcn
BuildRequires: pkgconfig BuildRequires: pkgconfig
# Need native version for msgfmt # Need native version for msgfmt
......
...@@ -34,10 +34,11 @@ VIR_LOG_INIT("driver"); ...@@ -34,10 +34,11 @@ VIR_LOG_INIT("driver");
/* XXX re-implement this for other OS, or use libtools helper lib ? */ /* XXX re-implement this for other OS, or use libtools helper lib ? */
#include <dlfcn.h>
#define DEFAULT_DRIVER_DIR LIBDIR "/libvirt/connection-driver" #define DEFAULT_DRIVER_DIR LIBDIR "/libvirt/connection-driver"
#ifdef HAVE_DLFCN_H
# include <dlfcn.h>
static void * static void *
virDriverLoadModuleFile(const char *file) virDriverLoadModuleFile(const char *file)
...@@ -126,6 +127,19 @@ virDriverLoadModuleFull(const char *path, ...@@ -126,6 +127,19 @@ virDriverLoadModuleFull(const char *path,
return ret; return ret;
} }
#else /* ! HAVE_DLFCN_H */
int
virDriverLoadModuleFull(const char *path ATTRIBUTE_UNUSED,
const char *regfunc ATTRIBUTE_UNUSED,
void **handle)
{
VIR_DEBUG("dlopen not available on this platform");
if (handle)
*handle = NULL;
return -1;
}
#endif /* ! HAVE_DLFCN_H */
int int
virDriverLoadModule(const char *name, virDriverLoadModule(const char *name,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册