]> granicus.if.org Git - curl/commitdiff
curl.h: use __has_declspec_attribute for shared builds
authorDon J Olmstead <don.j.olmstead@gmail.com>
Mon, 25 Feb 2019 22:17:51 +0000 (14:17 -0800)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 27 Feb 2019 07:35:43 +0000 (08:35 +0100)
Closes #3616

include/curl/curl.h

index 88e1f39e878e6a386d6f2eef7b7f243392d4943c..f501fe631074f1c7eb0c079e5576e4d234734293 100644 (file)
 #include <support/SupportDefs.h>
 #endif
 
+/* Compatibility for non-Clang compilers */
+#ifndef __has_declspec_attribute
+#  define __has_declspec_attribute(x) 0
+#endif
+
 #ifdef  __cplusplus
 extern "C" {
 #endif
@@ -109,7 +114,9 @@ typedef void CURLSH;
 
 #ifdef CURL_STATICLIB
 #  define CURL_EXTERN
-#elif defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)
+#elif defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__) || \
+     (__has_declspec_attribute(dllexport) && \
+      __has_declspec_attribute(dllimport))
 #  if defined(BUILDING_LIBCURL)
 #    define CURL_EXTERN  __declspec(dllexport)
 #  else