]> Savannah Git Hosting - gnulib.git/commitdiff
string, wchar: Fix compilation error on MSVC (regression 2021-09-07).
authorBruno Haible <bruno@clisp.org>
Sun, 15 May 2022 11:25:46 +0000 (13:25 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 15 May 2022 11:25:46 +0000 (13:25 +0200)
* lib/string.in.h (free): For MSVC, add the dllimport specification if
the MSVC headers have it.
* lib/wchar.in.h (free): Likewise.

ChangeLog
lib/string.in.h
lib/wchar.in.h

index 42f7e2cc5494b39f59877af2a5d2f54fdd293867..2d98fca9384469f3cae8d57746bf5c2d9ef6fb36 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-05-15  Bruno Haible  <bruno@clisp.org>
+
+       string, wchar: Fix compilation error on MSVC (regression 2021-09-07).
+       * lib/string.in.h (free): For MSVC, add the dllimport specification if
+       the MSVC headers have it.
+       * lib/wchar.in.h (free): Likewise.
+
 2022-05-14  Bruno Haible  <bruno@clisp.org>
 
        glob tests: Fix a warning (regression from 2022-03-23).
index 33160b25254ac8ef752167332fa5901eb0748aff..3996da9fcb5d4f3edee938d5565004e450809908 100644 (file)
@@ -122,8 +122,12 @@ _GL_EXTERN_C void rpl_free (void *);
 #  undef _GL_ATTRIBUTE_DEALLOC_FREE
 #  define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
 # else
-#  if defined _MSC_VER
-_GL_EXTERN_C void __cdecl free (void *);
+#  if defined _MSC_VER && !defined free
+_GL_EXTERN_C
+#   if defined _DLL
+     __declspec (dllimport)
+#   endif
+     void __cdecl free (void *);
 #  else
 #   if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
 _GL_EXTERN_C void free (void *) throw ();
@@ -133,8 +137,12 @@ _GL_EXTERN_C void free (void *);
 #  endif
 # endif
 #else
-# if defined _MSC_VER
-_GL_EXTERN_C void __cdecl free (void *);
+# if defined _MSC_VER && !defined free
+_GL_EXTERN_C
+#   if defined _DLL
+     __declspec (dllimport)
+#   endif
+     void __cdecl free (void *);
 # else
 #  if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
 _GL_EXTERN_C void free (void *) throw ();
index 0d5c0b7abe7c519de8aa8246d74a881a8fed693a..835ddbe65924ad46e481fd8461c1e8c8de2ab5ca 100644 (file)
@@ -185,8 +185,12 @@ _GL_EXTERN_C void rpl_free (void *);
 #  undef _GL_ATTRIBUTE_DEALLOC_FREE
 #  define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
 # else
-#  if defined _MSC_VER
-_GL_EXTERN_C void __cdecl free (void *);
+#  if defined _MSC_VER && !defined free
+_GL_EXTERN_C
+#   if defined _DLL
+     __declspec (dllimport)
+#   endif
+     void __cdecl free (void *);
 #  else
 #   if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
 _GL_EXTERN_C void free (void *) throw ();
@@ -196,8 +200,12 @@ _GL_EXTERN_C void free (void *);
 #  endif
 # endif
 #else
-# if defined _MSC_VER
-_GL_EXTERN_C void __cdecl free (void *);
+# if defined _MSC_VER && !defined free
+_GL_EXTERN_C
+#   if defined _DLL
+     __declspec (dllimport)
+#   endif
+     void __cdecl free (void *);
 # else
 #  if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
 _GL_EXTERN_C void free (void *) throw ();