Use __has_declspec_attribute for shared builds

This commit is contained in:
Don 2018-09-05 10:01:50 -07:00 committed by GitHub
parent f79a58120e
commit d82811303b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -31,6 +31,11 @@
# define WIN32 # define WIN32
#endif #endif
/* Compatibility for non-Clang compilers */
#ifndef __has_declspec_attribute
# define __has_declspec_attribute(x) 0
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -51,7 +56,7 @@ extern "C" {
#ifdef NGHTTP2_STATICLIB #ifdef NGHTTP2_STATICLIB
# define NGHTTP2_EXTERN # define NGHTTP2_EXTERN
#elif defined(WIN32) #elif defined(WIN32) || (__has_declspec_attribute(dllexport) && __has_declspec_attribute(dllimport))
# ifdef BUILDING_NGHTTP2 # ifdef BUILDING_NGHTTP2
# define NGHTTP2_EXTERN __declspec(dllexport) # define NGHTTP2_EXTERN __declspec(dllexport)
# else /* !BUILDING_NGHTTP2 */ # else /* !BUILDING_NGHTTP2 */