httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Kobes <ra...@theoryx5.uwinnipeg.ca>
Subject [apreq-2] perl glue on Win32
Date Mon, 16 Jun 2003 04:55:36 GMT
I'm trying to build the perl glue on Win32, and have
found a few things that need changing. One thing, that's
Win32 specific, is how APREQ_DECLARE in apreq.h is defined;
I've found the following seems to work:
==========================================================
Index: apreq.h
===================================================================
RCS file: /home/cvspublic/httpd-apreq-2/src/apreq.h,v
retrieving revision 1.21
diff -u -r1.21 apreq.h
--- apreq.h	15 Jun 2003 10:33:01 -0000	1.21
+++ apreq.h	16 Jun 2003 04:40:45 -0000
@@ -92,14 +92,13 @@
  * @{
  */

-/* XXX temporary workaround for Win32 */
-#ifndef WIN32
-
+#ifdef WIN32
+#define APREQ_DECLARE(type)            __declspec(dllexport) type __stdcall
+#define APREQ_DECLARE_NONSTD(type)     __declspec(dllexport) type
+#define APREQ_DECLARE_DATA             __declspec(dllexport)
+#else
 #define APREQ_DECLARE(d)                APR_DECLARE(d)
 #define APREQ_DECLARE_NONSTD(d)         APR_DECLARE_NONSTD(d)
-#else
-#define APREQ_DECLARE(d)                d
-#define APREQ_DECLARE_NONSTD(d)         d
 #endif

 #define APREQ_URL_ENCTYPE               "application/x-www-form-urlencoded"
==================================================================
I tried defining APREQ_DECLARE in terms of APR_DECLARE, as
is done on non-Win32, and then use a compile-time flag
APR_DECLARE_EXPORT, which I thought would do the same
as the above, but then ran into problems with exporting
and importing some symbols from the tests and from mod_apreq.

With this, I then get a couple of errors in compiling libapreq.
The first one, from apreq_cookie.c, says
===================================================================
apreq_cookie.c
..\src\apreq_cookie.c(65) : error C2059: syntax error : '('
..\src\apreq_cookie.c(71) : error C2059: syntax error : '('
==================================================================
I think this is because VC++ seems to get confused by the
declarations/definitions of apreq_cookie and apreq_add_cookie;
the following
=================================================================
Index: apreq_cookie.c
===================================================================
RCS file: /home/cvspublic/httpd-apreq-2/src/apreq_cookie.c,v
retrieving revision 1.15
diff -u -r1.15 apreq_cookie.c
--- apreq_cookie.c	9 Jun 2003 06:36:06 -0000	1.15
+++ apreq_cookie.c	16 Jun 2003 04:40:24 -0000
@@ -62,16 +62,19 @@
 #include "apr_lib.h"


-APREQ_DECLARE(apreq_cookie_t *) (apreq_cookie)(const apreq_jar_t *jar,
-                                               const char *name)
+APREQ_DECLARE(apreq_cookie_t *) apreq_cookie(const apreq_jar_t *jar,
+                                             const char *name)
 {
-    return apreq_cookie(jar,name);
+  return apreq_value_to_cookie(apreq_char_to_value(
+                                                   apr_table_get(jar->cookies,
+                                                                 name)));
 }

-APREQ_DECLARE(void) (apreq_add_cookie)(apreq_jar_t *jar,
-                                       const apreq_cookie_t *c)
+APREQ_DECLARE(void) apreq_add_cookie(apreq_jar_t *jar,
+                                     const apreq_cookie_t *c)
 {
-    apreq_add_cookie(jar,c);
+    apr_table_addn(jar->cookies,
+                   c->v.name,c->v.data);
 }

 APREQ_DECLARE(void) apreq_cookie_expires(apr_pool_t *p,
Index: apreq_cookie.h
===================================================================
RCS file: /home/cvspublic/httpd-apreq-2/src/apreq_cookie.h,v
retrieving revision 1.15
diff -u -r1.15 apreq_cookie.h
--- apreq_cookie.h	15 Jun 2003 10:33:01 -0000	1.15
+++ apreq_cookie.h	16 Jun 2003 04:40:25 -0000
@@ -125,8 +125,6 @@

 APREQ_DECLARE(apreq_cookie_t *)apreq_cookie(const apreq_jar_t *jar,
                                             const char *name);
-#define apreq_cookie(j,k) apreq_value_to_cookie(apreq_char_to_value( \
-                              apr_table_get((j)->cookies,k)))

 /**
  * Adds a cookie by pushing it to the bottom of the jar.
@@ -137,8 +135,6 @@

 APREQ_DECLARE(void) apreq_add_cookie(apreq_jar_t *jar,
                                      const apreq_cookie_t *c);
-#define apreq_add_cookie(j,c) apr_table_addn((j)->cookies,\
-                                            (c)->v.name,(c)->v.data)

 /**
  * Parse the incoming "Cookie:" headers into a cookie jar.
====================================================================
(which moves the definitions of these in apreq_cookie.h into
the declarations in apreq_cookie.c) lets VC++ gets past this.
The next thing, in apreq_tables.c, is an error:
====================================================================
apreq_tables.c ..\src\apreq_tables.c(504) : error C2152: '=' :
pointers to functions with different attributes
..\src\apreq_tables.c(505) : error C2152: '=' : pointers to
functions with different attributes
===================================================================
I'm not sure of this, but the following helps here:
==================================================================
Index: apreq_tables.c
===================================================================
RCS file: /home/cvspublic/httpd-apreq-2/src/apreq_tables.c,v
retrieving revision 1.31
diff -u -r1.31 apreq_tables.c
--- apreq_tables.c	20 May 2003 20:10:59 -0000	1.31
+++ apreq_tables.c	16 Jun 2003 04:40:35 -0000
@@ -501,8 +501,8 @@
     /* XXX: is memset(*,-1,*) portable ??? */
     memset(t->root, -1, TABLE_HASH_SIZE * sizeof(int));

-    t->merge  = apreq_merge_values;
-    t->copy   = apreq_copy_value;
+    t->merge  = (apreq_value_merge_t *) apreq_merge_values;
+    t->copy   = (apreq_value_copy_t *) apreq_copy_value;
     t->ghosts = 0;
     return t;
 }
=============================================================
Finally, in running the tests, I get an error about
apr_table_compress being unresolved (I'm running Apache/2.0.46).
The following
===========================================================
Index: performance.c
===================================================================
RCS file: /home/cvspublic/httpd-apreq-2/t/performance.c,v
retrieving revision 1.3
diff -u -r1.3 performance.c
--- performance.c	20 May 2003 20:27:32 -0000	1.3
+++ performance.c	16 Jun 2003 04:46:23 -0000
@@ -164,7 +164,10 @@
        apr_table_t *s = init_apr(NELTS);
 /*       apr_table_t *t = apr_table_make(p,NELTS);
 //       apr_table_overlap(t,s,APR_OVERLAP_TABLES_MERGE);
-*/      apr_table_compress(s);
+*/
+#ifndef WIN32
+         apr_table_compress(s);
+#endif
     }
     apr_delta = apr_time_now() - apr_delta;
====================================================================
helps here.

With these diffs, all the enabled tests under t/ pass. The
perl modules build successfully, but there's some problems
with some of the tests, specifically involving inheritance
(for example, in TestApReq/big_input.pm, the methods
$apr->content_type() and $apr->print() can't be found,
but the tests are OK if $r->content_type() and $r->print()
are used). But I'll leave that until the above gets resolved.

-- 
best regards,
randy

Mime
View raw message