[libvirt] [PATCH] internal: don't use weak symbols for Win32 platform

Daniel P. Berrange berrange at redhat.com
Tue Jul 11 14:32:03 UTC 2017


The Win32 platform will fail to link if you use weak symbols
because it is incompatible with exporting symbols in a DLL:

Cannot export virRandomGenerateWWN: symbol wrong type (2 vs 3)

We only need weak symbols for our test suite to do LD_PRELOAD
and this doesn't work on Win32, so we can just drop the hack
for Win32

Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---

Pushed as a build fix for Win32

 src/internal.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/internal.h b/src/internal.h
index 00edd4f..edc3587 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -128,10 +128,14 @@
  *
  */
 # ifndef ATTRIBUTE_MOCKABLE
-#  if __GNUC_PREREQ(4, 5)
-#   define ATTRIBUTE_MOCKABLE __attribute__((__noinline__, __noclone__, __weak__))
+#  if defined(WIN32)
+#   define ATTRIBUTE_MOCKABLE
 #  else
-#   define ATTRIBUTE_MOCKABLE __attribute__((__noinline__, __weak__))
+#   if __GNUC_PREREQ(4, 5)
+#    define ATTRIBUTE_MOCKABLE __attribute__((__noinline__, __noclone__, __weak__))
+#   else
+#    define ATTRIBUTE_MOCKABLE __attribute__((__noinline__, __weak__))
+#   endif
 #  endif
 # endif
 
-- 
2.9.4




More information about the libvir-list mailing list