On 11/3/2015 6:33 AM, ic...@apache.org wrote:
Author: icing
Date: Tue Nov  3 14:33:11 2015
New Revision: 1712300

URL: http://svn.apache.org/viewvc?rev=1712300&view=rev
Log:
rework of output handling on stream/session close, rework of cleartext (http:) 
output to pass buckets to core filters, splitting of stream/io memory pools for 
stability and less sync

Added:
     httpd/httpd/trunk/modules/http2/h2_bucket_eoc.c
     httpd/httpd/trunk/modules/http2/h2_bucket_eoc.h
     httpd/httpd/trunk/modules/http2/h2_bucket_eos.c
     httpd/httpd/trunk/modules/http2/h2_bucket_eos.h
Modified:
...
     httpd/httpd/trunk/modules/http2/h2_util.c

Added: httpd/httpd/trunk/modules/http2/h2_bucket_eoc.c
URL: 
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_bucket_eoc.c?rev=1712300&view=auto
==============================================================================
...
+
+AP_DECLARE(apr_bucket *) h2_bucket_eoc_make(apr_bucket *b,
+                                            h2_session *session)

No :) we cannot export with AP_DELARE in modules on Windows because we need to keep them separate from the AP_DECLARE functions we are going to be importing from core.

.\h2_util.c(727) : error C2491: 'h2_transfer_brigade' : definition of dllimport function not allowed .\h2_bucket_eos.c(60) : error C2491: 'h2_bucket_eos_make' : definition of dllimport function not allowed .\h2_bucket_eos.c(74) : error C2491: 'h2_bucket_eos_create' : definition of dllimport function not allowed .\h2_bucket_eos.c(101) : error C2491: 'ap_bucket_type_h2_eos' : definition of dllimport data not allowed .\h2_bucket_eoc.c(60) : error C2491: 'h2_bucket_eoc_make' : definition of dllimport function not allowed .\h2_bucket_eoc.c(74) : error C2491: 'h2_bucket_eoc_create' : definition of dllimport function not allowed .\h2_bucket_eoc.c(101) : error C2491: 'ap_bucket_type_h2_eoc' : definition of dllimport data not allowed

If we take a page from other modules (mod_dav/proxy/ssl) we can see the need to come up with an private set of declares.
I have the attached patch ready to commit.
...
+AP_DECLARE_DATA const apr_bucket_type_t ap_bucket_type_h2_eoc = {
+    "H2EOC", 5, APR_BUCKET_METADATA,
+    bucket_destroy,
+    bucket_read,
+    apr_bucket_setaside_noop,
+    apr_bucket_split_notimpl,
+    apr_bucket_shared_copy
+};
+

>>> Nit <<<
Should we really be declaring anything for export with an ap_* in a loadable module? I thought the ap_* name was reserved for core only, I may be wrong.


Index: modules/http2/h2_bucket_eoc.c
===================================================================
--- modules/http2/h2_bucket_eoc.c	(revision 1712389)
+++ modules/http2/h2_bucket_eoc.c	(working copy)
@@ -54,7 +54,7 @@
     return APR_SUCCESS;
 }
 
-AP_DECLARE(apr_bucket *) h2_bucket_eoc_make(apr_bucket *b, 
+H2_DECLARE(apr_bucket *) h2_bucket_eoc_make(apr_bucket *b, 
                                             h2_session *session)
 {
     h2_bucket_eoc *h;
@@ -68,7 +68,7 @@
     return b;
 }
 
-AP_DECLARE(apr_bucket *) h2_bucket_eoc_create(apr_bucket_alloc_t *list,
+H2_DECLARE(apr_bucket *) h2_bucket_eoc_create(apr_bucket_alloc_t *list,
                                               h2_session *session)
 {
     apr_bucket *b = apr_bucket_alloc(sizeof(*b), list);
@@ -97,7 +97,7 @@
     }
 }
 
-AP_DECLARE_DATA const apr_bucket_type_t ap_bucket_type_h2_eoc = {
+const apr_bucket_type_t H2_DECLARE_DATA ap_bucket_type_h2_eoc = {
     "H2EOC", 5, APR_BUCKET_METADATA,
     bucket_destroy,
     bucket_read,
Index: modules/http2/h2_bucket_eoc.h
===================================================================
--- modules/http2/h2_bucket_eoc.h	(revision 1712389)
+++ modules/http2/h2_bucket_eoc.h	(working copy)
@@ -19,13 +19,13 @@
 struct h2_session;
 
 /** End Of HTTP/2 SESSION (H2EOC) bucket */
-AP_DECLARE_DATA extern const apr_bucket_type_t ap_bucket_type_h2_eoc;
+H2_DECLARE_DATA extern const apr_bucket_type_t ap_bucket_type_h2_eoc;
 
 
-AP_DECLARE(apr_bucket *) h2_bucket_eoc_make(apr_bucket *b, 
+H2_DECLARE(apr_bucket *) h2_bucket_eoc_make(apr_bucket *b, 
                                             struct h2_session *session);
 
-AP_DECLARE(apr_bucket *) h2_bucket_eoc_create(apr_bucket_alloc_t *list,
+H2_DECLARE(apr_bucket *) h2_bucket_eoc_create(apr_bucket_alloc_t *list,
                                               struct h2_session *session);
 
 #endif /* mod_http2_h2_bucket_eoc_h */
Index: modules/http2/h2_bucket_eos.c
===================================================================
--- modules/http2/h2_bucket_eos.c	(revision 1712389)
+++ modules/http2/h2_bucket_eos.c	(working copy)
@@ -54,7 +54,7 @@
     return APR_SUCCESS;
 }
 
-AP_DECLARE(apr_bucket *) h2_bucket_eos_make(apr_bucket *b, 
+H2_DECLARE(apr_bucket *) h2_bucket_eos_make(apr_bucket *b, 
                                                    h2_stream *stream)
 {
     h2_bucket_eos *h;
@@ -68,7 +68,7 @@
     return b;
 }
 
-AP_DECLARE(apr_bucket *) h2_bucket_eos_create(apr_bucket_alloc_t *list,
+H2_DECLARE(apr_bucket *) h2_bucket_eos_create(apr_bucket_alloc_t *list,
                                                      h2_stream *stream)
 {
     apr_bucket *b = apr_bucket_alloc(sizeof(*b), list);
@@ -97,7 +97,7 @@
     }
 }
 
-AP_DECLARE_DATA const apr_bucket_type_t ap_bucket_type_h2_eos = {
+const apr_bucket_type_t H2_DECLARE_DATA ap_bucket_type_h2_eos = {
     "H2EOS", 5, APR_BUCKET_METADATA,
     bucket_destroy,
     bucket_read,
Index: modules/http2/h2_bucket_eos.h
===================================================================
--- modules/http2/h2_bucket_eos.h	(revision 1712389)
+++ modules/http2/h2_bucket_eos.h	(working copy)
@@ -19,13 +19,13 @@
 struct h2_stream;
 
 /** End Of HTTP/2 STREAM (H2EOS) bucket */
-AP_DECLARE_DATA extern const apr_bucket_type_t ap_bucket_type_h2_eos;
+H2_DECLARE_DATA extern const apr_bucket_type_t ap_bucket_type_h2_eos;
 
 
-AP_DECLARE(apr_bucket *) h2_bucket_eos_make(apr_bucket *b, 
+H2_DECLARE(apr_bucket *) h2_bucket_eos_make(apr_bucket *b, 
                                             struct h2_stream *stream);
 
-AP_DECLARE(apr_bucket *) h2_bucket_eos_create(apr_bucket_alloc_t *list,
+H2_DECLARE(apr_bucket *) h2_bucket_eos_create(apr_bucket_alloc_t *list,
                                               struct h2_stream *stream);
 
 #endif /* mod_http2_h2_bucket_stream_eos_h */
Index: modules/http2/h2_private.h
===================================================================
--- modules/http2/h2_private.h	(revision 1712389)
+++ modules/http2/h2_private.h	(working copy)
@@ -33,4 +33,27 @@
 #define H2_HEADER_PATH_LEN   5
 #define H2_CRLF             "\r\n"
 
+
+/* Create a set of H2_DECLARE(type), H2_DECLARE_NONSTD(type) and
+ * H2_DECLARE_DATA with appropriate export and import tags for the platform
+ */
+#if !defined(WIN32)
+#define H2_DECLARE(type)            type
+#define H2_DECLARE_NONSTD(type)     type
+#define H2_DECLARE_DATA
+#elif defined(H2_DECLARE_STATIC)
+#define H2_DECLARE(type)            type __stdcall
+#define H2_DECLARE_NONSTD(type)     type
+#define H2_DECLARE_DATA
+#elif defined(H2_DECLARE_EXPORT)
+#define H2_DECLARE(type)            __declspec(dllexport) type __stdcall
+#define H2_DECLARE_NONSTD(type)     __declspec(dllexport) type
+#define H2_DECLARE_DATA             __declspec(dllexport)
+#else
+#define H2_DECLARE(type)            __declspec(dllimport) type __stdcall
+#define H2_DECLARE_NONSTD(type)     __declspec(dllimport) type
+#define H2_DECLARE_DATA             __declspec(dllimport)
 #endif
+
+
+#endif /* mod_h2_h2_private_h */
Index: modules/http2/h2_util.c
===================================================================
--- modules/http2/h2_util.c	(revision 1712389)
+++ modules/http2/h2_util.c	(working copy)
@@ -719,7 +719,7 @@
 
 }
 
-AP_DECLARE(apr_status_t) h2_transfer_brigade(apr_bucket_brigade *to,
+H2_DECLARE(apr_status_t) h2_transfer_brigade(apr_bucket_brigade *to,
                                              apr_bucket_brigade *from, 
                                              apr_pool_t *p,
                                              apr_size_t *plen,
Index: modules/http2/h2_util.h
===================================================================
--- modules/http2/h2_util.h	(revision 1712389)
+++ modules/http2/h2_util.h	(working copy)
@@ -154,7 +154,7 @@
  * @param plen maximum bytes to transfer, actual bytes transferred
  * @param peos if an EOS bucket was transferred
  */
-AP_DECLARE(apr_status_t) h2_transfer_brigade(apr_bucket_brigade *to,
+H2_DECLARE(apr_status_t) h2_transfer_brigade(apr_bucket_brigade *to,
                                              apr_bucket_brigade *from, 
                                              apr_pool_t *p,
                                              apr_size_t *plen,

Reply via email to