提交 190aaa26 编写于 作者: M Matthias Bolte

Fix export of virConnectAuthPtrDefault for MinGW builds

Use the __declspec(dllexport/dllimport) stuff to export the symbol,
otherwise accessing virConnectAuthPtrDefault triggers a segfault.
上级 460e7b6a
......@@ -1732,6 +1732,7 @@ CYGWIN_EXTRA_LDFLAGS=
CYGWIN_EXTRA_LIBADD=
CYGWIN_EXTRA_PYTHON_LIBADD=
MINGW_EXTRA_LDFLAGS=
WIN32_EXTRA_CFLAGS=
case "$host" in
*-*-cygwin*)
CYGWIN_EXTRA_LDFLAGS="-no-undefined"
......@@ -1744,10 +1745,20 @@ case "$host" in
MINGW_EXTRA_LDFLAGS="-no-undefined"
;;
esac
case "$host" in
*-*-mingw* | *-*-cygwin* | *-*-msvc* )
# If the host is Windows, and shared libraries are disabled, we
# need to add -DLIBVIRT_STATIC to the CFLAGS for proper linking
if test "x$enable_shared" = "xno"; then
WIN32_EXTRA_CFLAGS="-DLIBVIRT_STATIC"
fi
;;
esac
AC_SUBST([CYGWIN_EXTRA_LDFLAGS])
AC_SUBST([CYGWIN_EXTRA_LIBADD])
AC_SUBST([CYGWIN_EXTRA_PYTHON_LIBADD])
AC_SUBST([MINGW_EXTRA_LDFLAGS])
AC_SUBST([WIN32_EXTRA_CFLAGS])
dnl Look for windres to build a Windows icon resource.
AC_CHECK_TOOL([WINDRES], [windres], [no])
......
......@@ -28,6 +28,7 @@ ignored_words = {
"ATTRIBUTE_UNUSED": (0, "macro keyword"),
"ATTRIBUTE_SENTINEL": (0, "macro keyword"),
"VIR_DEPRECATED": (0, "macro keyword"),
"VIR_EXPORT_VAR": (0, "macro keyword"),
"WINAPI": (0, "Windows keyword"),
"__declspec": (3, "Windows keyword"),
"__stdcall": (0, "Windows keyword"),
......
......@@ -29,6 +29,20 @@ extern "C" {
# endif
#endif /* VIR_DEPRECATED */
#ifdef WIN32
# ifdef LIBVIRT_STATIC
# define VIR_EXPORT_VAR extern
# else
# ifdef IN_LIBVIRT
# define VIR_EXPORT_VAR __declspec(dllexport)
# else
# define VIR_EXPORT_VAR __declspec(dllimport) extern
# endif
# endif
#else
# define VIR_EXPORT_VAR extern
#endif
/**
* virConnect:
*
......@@ -499,7 +513,7 @@ struct _virConnectAuth {
typedef struct _virConnectAuth virConnectAuth;
typedef virConnectAuth *virConnectAuthPtr;
extern virConnectAuthPtr virConnectAuthPtrDefault;
VIR_EXPORT_VAR virConnectAuthPtr virConnectAuthPtrDefault;
/**
* VIR_UUID_BUFLEN:
......
......@@ -20,7 +20,9 @@ INCLUDES = \
-DLOCAL_STATE_DIR=\""$(localstatedir)"\" \
-DGETTEXT_PACKAGE=\"$(PACKAGE)\" \
$(WARN_CFLAGS) \
$(LOCK_CHECKING_CFLAGS)
$(LOCK_CHECKING_CFLAGS) \
-DIN_LIBVIRT \
$(WIN32_EXTRA_CFLAGS)
EXTRA_DIST = $(conf_DATA)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册