summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2022-05-15 13:25:46 +0200
committerBruno Haible <bruno@clisp.org>2022-05-15 13:25:46 +0200
commit4bc2b6f67259e3fb54d21d3b93e7cab12161f7fd (patch)
treeab23d7d32f82924c01c57f5da7d99d07e3cfb5f2 /lib
parent754d33cbd78bb93831a812c2853bb49eea0698ae (diff)
downloadgnulib-4bc2b6f67259e3fb54d21d3b93e7cab12161f7fd.tar.gz
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/string.in.h16
-rw-r--r--lib/wchar.in.h16
2 files changed, 24 insertions, 8 deletions
diff --git a/lib/string.in.h b/lib/string.in.h
index 33160b2525..3996da9fcb 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -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 ();
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index 0d5c0b7abe..835ddbe659 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -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 ();