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 Re: [apreq-2] perl glue on Win32
Date Tue, 17 Jun 2003 06:34:10 GMT
On Mon, 16 Jun 2003, Joe Schaefer wrote:

> Randy Kobes <randy@theoryx5.uwinnipeg.ca> writes:
>
> [...apreq.h patch...]
>
> +0. I can't judge the correctness of this patch wrt Win32, but I've been
> following a commit-then-wait-for-Stas'-wrath^H^H^H^H^H^Hreview myself
> ;-).  Please use the same criterion regarding this and similar Win32
> patches.  If someone breaks your Win32 port in a future commit, just
> holler.

OK :) I committed that change. One thing that was strange -
in the original I had
   #ifdef WIN32
   #define APREQ_DECLARE ...
   #else
   #define APREQ_DELARE ...
   #endif
but then found, in running build/xsbuilder, that the glue
for Apache::Request wasn't being built by ExtUtils::XSBuilder,
but only that for Apache::Cookie. Changing the order around:
  #ifndef WIN32
  #define ...
  #else
  #define ...
  #endif
seems to fix this - I hope this is OK on unix ...

[ .. ]
> > 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
> [...apreq_cookie.[ch] patch...]
> +1.

Thanks - that's been committed ...

> > 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:
[ .. ]
> The original source appears broken, but at the moment I
> don't like those casts.  Is it possible to change the
> apreq_value_(merge|copy)_t typedefs to include APREQ_DECLARE?
>
>   typedef APREQ_DECLARE(apreq_value_t *)
>   (apreq_value_merge_t) (apr_pool_t *p, const apr_array_header_t *a);
>
>   typedef APREQ_DECLARE(apreq_value_t *)
>   (apreq_value_copy_t)(apr_pool_t *p, const apreq_value_t *v);
>
> Not sure that will work though.

That's right - there were various syntax errors in trying that.

> Another possibility would be
> to drop APREQ_DECLARE from apreq_copy_value() & apreq_merge_values()
> in apreq.[ch].

That does work, as in the following:
===============================================================
Index: apreq.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/src/apreq.c,v
retrieving revision 1.19
diff -u -r1.19 apreq.c
--- apreq.c	7 Jun 2003 20:07:41 -0000	1.19
+++ apreq.c	17 Jun 2003 06:28:44 -0000
@@ -84,8 +84,8 @@
 }


-APREQ_DECLARE(apreq_value_t *)apreq_copy_value(apr_pool_t *p,
-                                               const apreq_value_t *val)
+apreq_value_t * apreq_copy_value(apr_pool_t *p,
+                                 const apreq_value_t *val)
 {
     apreq_value_t *v;
     if (val == NULL)
@@ -101,8 +101,8 @@
     return v;
 }

-APREQ_DECLARE(apreq_value_t *)apreq_merge_values(apr_pool_t *p,
-                                           const apr_array_header_t *arr)
+apreq_value_t * apreq_merge_values(apr_pool_t *p,
+                                   const apr_array_header_t *arr)
 {
     apreq_value_t *a = *(apreq_value_t **)(arr->elts);
     apreq_value_t *v = apreq_char_to_value( apreq_join(p, ", ", arr, AS_IS) );
Index: apreq.h
===================================================================
RCS file: /home/cvs/httpd-apreq-2/src/apreq.h,v
retrieving revision 1.23
diff -u -r1.23 apreq.h
--- apreq.h	17 Jun 2003 06:16:36 -0000	1.23
+++ apreq.h	17 Jun 2003 06:28:44 -0000
@@ -159,16 +159,16 @@
  * @param p  Pool.
  * @param val Original value to copy.
  */
-APREQ_DECLARE(apreq_value_t *) apreq_copy_value(apr_pool_t *p,
-                                                const apreq_value_t *val);
+apreq_value_t * apreq_copy_value(apr_pool_t *p,
+                                 const apreq_value_t *val);

 /**
  * Merges an array of values into one.
  * @param p   Pool from which the new value is generated.
  * @param arr Array of apr_value_t *.
  */
-APREQ_DECLARE(apreq_value_t *) apreq_merge_values(apr_pool_t *p,
-                                            const apr_array_header_t *arr);
+apreq_value_t * apreq_merge_values(apr_pool_t *p,
+                                   const apr_array_header_t *arr);

 /**
  * Fetches the enctype from the environment.
====================================================================
> > Finally, in running the tests, I get an error about
> > apr_table_compress being unresolved (I'm running Apache/2.0.46).
> > The following
> [...]
>
> There is no apr_table_compress() function in apr_tables yet,
> so the undefined symbol will occur on all platforms.
>
> The plan is to eventually drop apreq_tables once we get
> the necessary (callback/compress) functionality into apr_tables.
> In the meantime I've taken performance.c and tables.c
> out of the CuTest suite, so I wouldn't worry about fixing
> those tests right now.

Thanks - I've taken them out of the Win32 build as well,
and now all the t/ tests pass (with the above diff applied
to apreq.[ch]).

> > 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).
>
> Hmm, this is a pretty important (and timely) issue.
> The base class for Apache::Request is determined
> at load-time via Apache::Request->env, which should
> normally return "Apache::RequestRec".  There might be
> a problem with apreq_xs_env not finding the
> apreq_env = "APACHE2" definition in mod_apreq.c.
> You might try adding some Perl_warn diagnostics to the
> APREQ_XS_DEFINE_ENV macro in xsbuilder/apreq_xs_postperl.h
> and check t/log/error_log for clues.

You're right on about that :) I changed in src/apreq_env.h
to declare apreq_env[] with dllexport if building mod_apreq
or libapreq_cgi, and to use dllimport for libapreq. With this,
all the perl glue tests now pass. Tnanks.

-- 
best regards,
randy

Mime
View raw message