mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
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: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
376cfc2a81
commit
8b9d017de3
@ -54,6 +54,8 @@ BuildRequires: mingw32-libxml2
|
||||
BuildRequires: mingw64-libxml2
|
||||
BuildRequires: mingw32-portablexdr
|
||||
BuildRequires: mingw64-portablexdr
|
||||
BuildRequires: mingw32-dlfcn
|
||||
BuildRequires: mingw64-dlfcn
|
||||
|
||||
BuildRequires: pkgconfig
|
||||
# Need native version for msgfmt
|
||||
|
18
src/driver.c
18
src/driver.c
@ -34,10 +34,11 @@ VIR_LOG_INIT("driver");
|
||||
|
||||
|
||||
/* XXX re-implement this for other OS, or use libtools helper lib ? */
|
||||
|
||||
#include <dlfcn.h>
|
||||
#define DEFAULT_DRIVER_DIR LIBDIR "/libvirt/connection-driver"
|
||||
|
||||
#ifdef HAVE_DLFCN_H
|
||||
# include <dlfcn.h>
|
||||
|
||||
|
||||
static void *
|
||||
virDriverLoadModuleFile(const char *file)
|
||||
@ -126,6 +127,19 @@ virDriverLoadModuleFull(const char *path,
|
||||
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
|
||||
virDriverLoadModule(const char *name,
|
||||
|
Loading…
Reference in New Issue
Block a user