From 1f7e6ea3fe9f9eb373f6238bf126864335ef404a Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 28 May 2015 22:36:43 +0900 Subject: [PATCH] Define NGHTTP2_EXTERN to __declspec(dllimport) when using nghttp2 The private global variable nghttp2_enable_strict_preface is also marked as NGHTTP2_EXTERN, but it is test purpose only (test with .dll), and not part of public API. It could be removed in the future release. --- lib/Makefile.am | 3 ++- lib/includes/nghttp2/nghttp2.h | 6 +++++- lib/nghttp2_session.c | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/Makefile.am b/lib/Makefile.am index 6d2393ef..5cf7fbed 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -25,7 +25,8 @@ SUBDIRS = includes EXTRA_DIST = Makefile.msvc AM_CFLAGS = $(WARNCFLAGS) -AM_CPPFLAGS = -I$(srcdir)/includes -I$(builddir)/includes @DEFS@ +AM_CPPFLAGS = -I$(srcdir)/includes -I$(builddir)/includes -DBUILDING_NGHTTP2 \ + @DEFS@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libnghttp2.pc diff --git a/lib/includes/nghttp2/nghttp2.h b/lib/includes/nghttp2/nghttp2.h index b1028a86..fde83355 100644 --- a/lib/includes/nghttp2/nghttp2.h +++ b/lib/includes/nghttp2/nghttp2.h @@ -51,8 +51,12 @@ extern "C" { #ifdef NGHTTP2_STATICLIB #define NGHTTP2_EXTERN #elif defined(WIN32) +#ifdef BUILDING_NGHTTP2 #define NGHTTP2_EXTERN __declspec(dllexport) -#else /* !defined(WIN32) */ +#else /* !BUILDING_NGHTTP2 */ +#define NGHTTP2_EXTERN __declspec(dllimport) +#endif /* !BUILDING_NGHTTP2 */ +#else /* !defined(WIN32) */ #define NGHTTP2_EXTERN #endif /* !defined(WIN32) */ diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index 7309aa0e..4f5c3b61 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -307,7 +307,8 @@ static void active_outbound_item_reset(nghttp2_active_outbound_item *aob, /* The global variable for tests where we want to disable strict preface handling. */ -int nghttp2_enable_strict_preface = 1; +/* Specify NGHTTP2_EXTERN, so that we can test using Win build dll. */ +NGHTTP2_EXTERN int nghttp2_enable_strict_preface = 1; static int session_new(nghttp2_session **session_ptr, const nghttp2_session_callbacks *callbacks,