You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Doug MacEachern <do...@covalent.net> on 2000/09/29 18:06:52 UTC

Re: updated version of libapreq-win32

On Thu, 28 Sep 2000, Jiho Hahm wrote:

> [omitted previous messages]
> 
> Yep, by defining MODPERL_EXPORTS in every .c file that gets compiled into mod_perl,
> those .c files will see the MODPERL_API_EXPORT functions as exports (being exported
> from the binary that the source file will end up in), and all other files that
> include mod_perl.h will see the functions as external functions to be imported from
> another DLL.

jiho, (cc-ing dev@perl.apache.org, where we should keep this discussion)
below is the version of your patch which i almost applied, but as randy
kobes explained to me (and was discussed on this list, but i didn't
listen close enough :), this can already taken care of by
including ApacheModulePerl.def, which is part of the current mod_perl cvs
tree.

Index: src/modules/ApacheModulePerl/ApacheModulePerl.dsp
===================================================================
RCS file: /home/cvs/modperl/src/modules/ApacheModulePerl/ApacheModulePerl.dsp,v
retrieving revision 1.7
diff -u -r1.7 ApacheModulePerl.dsp
--- src/modules/ApacheModulePerl/ApacheModulePerl.dsp	2000/09/13 06:06:43	1.7
+++ src/modules/ApacheModulePerl/ApacheModulePerl.dsp	2000/09/28 21:26:23
@@ -68,7 +68,7 @@
 # PROP Intermediate_Dir "Debug"
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINSOCK2API_" /D "_MSWSOCK_" /D "_WINDOWS" /FR /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINSOCK2API_" /D "_MSWSOCK_" /D "_WINDOWS" /FR /YX /FD /c
 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
 # ADD BASE RSC /l 0x409 /d "_DEBUG"
Index: src/modules/perl/Apache.xs
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/Apache.xs,v
retrieving revision 1.114
diff -u -r1.114 Apache.xs
--- src/modules/perl/Apache.xs	2000/09/28 19:28:33	1.114
+++ src/modules/perl/Apache.xs	2000/09/28 21:26:24
@@ -47,6 +47,7 @@
  * ====================================================================
  */
 
+#define MODPERL_EXPORTS
 #define CORE_PRIVATE
 #include "mod_perl.h"
 #include "mod_perl_xs.h"
Index: src/modules/perl/Connection.xs
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/Connection.xs,v
retrieving revision 1.9
diff -u -r1.9 Connection.xs
--- src/modules/perl/Connection.xs	2000/04/11 16:38:27	1.9
+++ src/modules/perl/Connection.xs	2000/09/28 21:26:24
@@ -1,3 +1,4 @@
+#define MODPERL_EXPORTS
 #define CORE_PRIVATE 
 #include "mod_perl.h" 
 
Index: src/modules/perl/Constants.xs
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/Constants.xs,v
retrieving revision 1.20
diff -u -r1.20 Constants.xs
--- src/modules/perl/Constants.xs	2000/03/30 00:44:40	1.20
+++ src/modules/perl/Constants.xs	2000/09/28 21:26:24
@@ -1,3 +1,4 @@
+#define MODPERL_EXPORTS
 #define CORE_PRIVATE
 #include "mod_perl.h"
 
Index: src/modules/perl/File.xs
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/File.xs,v
retrieving revision 1.9
diff -u -r1.9 File.xs
--- src/modules/perl/File.xs	1999/06/04 17:50:46	1.9
+++ src/modules/perl/File.xs	2000/09/28 21:26:25
@@ -1,4 +1,4 @@
-
+#define MODPERL_EXPORTS
 #include "mod_perl.h"
 
 #define ap_fopen(r, name, mode) \
Index: src/modules/perl/Log.xs
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/Log.xs,v
retrieving revision 1.11
diff -u -r1.11 Log.xs
--- src/modules/perl/Log.xs	2000/03/31 17:07:24	1.11
+++ src/modules/perl/Log.xs	2000/09/28 21:26:25
@@ -1,3 +1,4 @@
+#define MODPERL_EXPORTS
 #include "mod_perl.h"
 
 #if MODULE_MAGIC_NUMBER >= MMN_132
Index: src/modules/perl/Server.xs
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/Server.xs,v
retrieving revision 1.7
diff -u -r1.7 Server.xs
--- src/modules/perl/Server.xs	2000/09/26 17:34:32	1.7
+++ src/modules/perl/Server.xs	2000/09/28 21:26:25
@@ -1,3 +1,4 @@
+#define MODPERL_EXPORTS
 #define CORE_PRIVATE 
 #include "mod_perl.h" 
 
Index: src/modules/perl/Table.xs
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/Table.xs,v
retrieving revision 1.10
diff -u -r1.10 Table.xs
--- src/modules/perl/Table.xs	2000/05/23 15:56:12	1.10
+++ src/modules/perl/Table.xs	2000/09/28 21:26:25
@@ -1,3 +1,4 @@
+#define MODPERL_EXPORTS
 #include "mod_perl.h"
 
 typedef struct {
Index: src/modules/perl/URI.xs
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/URI.xs,v
retrieving revision 1.6
diff -u -r1.6 URI.xs
--- src/modules/perl/URI.xs	2000/04/10 14:07:07	1.6
+++ src/modules/perl/URI.xs	2000/09/28 21:26:26
@@ -1,3 +1,4 @@
+#define MODPERL_EXPORTS
 #include "mod_perl.h"
 #include "mod_perl_xs.h"
 
Index: src/modules/perl/Util.xs
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/Util.xs,v
retrieving revision 1.9
diff -u -r1.9 Util.xs
--- src/modules/perl/Util.xs	2000/03/04 20:55:47	1.9
+++ src/modules/perl/Util.xs	2000/09/28 21:26:26
@@ -1,3 +1,4 @@
+#define MODPERL_EXPORTS
 #include "mod_perl.h"
 #include "util_date.h"
 
Index: src/modules/perl/mod_perl.c
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.c,v
retrieving revision 1.129
diff -u -r1.129 mod_perl.c
--- src/modules/perl/mod_perl.c	2000/09/27 16:13:28	1.129
+++ src/modules/perl/mod_perl.c	2000/09/28 21:26:35
@@ -54,6 +54,7 @@
  * And so it was done...
  */
 
+#define MODPERL_EXPORTS
 #define CORE_PRIVATE 
 #include "mod_perl.h"
 
@@ -1697,7 +1698,7 @@
     return status;
 }
 
-request_rec *perl_request_rec(request_rec *r)
+MODPERL_API_EXPORT(request_rec *) perl_request_rec(request_rec *r)
 {
     if(r != NULL) {
 	mp_request_rec = (IV)r;
Index: src/modules/perl/mod_perl.h
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.h,v
retrieving revision 1.104
diff -u -r1.104 mod_perl.h
--- src/modules/perl/mod_perl.h	2000/09/27 23:51:34	1.104
+++ src/modules/perl/mod_perl.h	2000/09/28 21:26:46
@@ -71,6 +71,16 @@
 #define SHARED_MODULE
 #endif
 
+#ifdef WIN32
+# ifdef MODPERL_EXPORTS
+#  define MODPERL_API_EXPORT(type)  __declspec(dllexport) type __stdcall
+# else
+#  define MODPERL_API_EXPORT(type)  __declspec(dllimport) type __stdcall
+# endif
+#else
+# define MODPERL_API_EXPORT(type)   type
+#endif
+
 #ifdef PERL_THREADS
 #define _INCLUDE_APACHE_FIRST
 #endif
@@ -1093,6 +1103,10 @@
 void xs_init (void);
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* mod_perl.c */
 
 /* generic handler stuff */ 
@@ -1128,7 +1142,7 @@
 /* per-request gunk */
 int mod_perl_sent_header(request_rec *r, int val);
 int mod_perl_seqno(SV *self, int inc);
-request_rec *perl_request_rec(request_rec *);
+MODPERL_API_EXPORT(request_rec *) perl_request_rec(request_rec *);
 void perl_setup_env(request_rec *r);
 SV  *perl_bless_request_rec(request_rec *); 
 void perl_set_request_rec(request_rec *); 
@@ -1149,7 +1163,7 @@
 void mod_perl_untaint(SV *sv);
 SV *mod_perl_gensym (char *pack);
 SV *mod_perl_slurp_filename(request_rec *r);
-SV *mod_perl_tie_table(table *t);
+MODPERL_API_EXPORT(SV *) mod_perl_tie_table(table *t);
 SV *perl_hvrv_magic_obj(SV *rv);
 void perl_tie_hash(HV *hv, char *pclass, SV *sv);
 void perl_util_cleanup(void);
@@ -1270,7 +1284,7 @@
 pool *perl_get_util_pool(void);
 pool *perl_get_startup_pool(void);
 server_rec *perl_get_startup_server(void);
-request_rec *sv2request_rec(SV *in, char *pclass, CV *cv);
+MODPERL_API_EXPORT(request_rec *) sv2request_rec(SV *in, char *pclass, CV *cv);
 
 /* PerlRunXS.xs */
 #define ApachePerlRun_name_with_virtualhost() \
@@ -1282,6 +1296,10 @@
 #define dOPMask \
 if(!op_mask) Newz(0, op_mask, maxo, char); \
 else         Zero(op_mask, maxo, char)
+
+#ifdef __cplusplus
+}
+#endif
 
 #ifdef PERL_SAFE_STARTUP


Re: updated version of libapreq-win32

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Mon, 2 Oct 2000, Doug MacEachern wrote:

[ ... ]
> 
> thanks randy.  how about this version of your patch, which just moves that
> hunk of code into it's own routine, that's called by
> init_tests_and_config() and by itself if $Is_Win32 ?
> 
[ ... ]

Hi Doug,
   That's great - applied to the mod_perl cvs version, and with
a patched libapreq for Win32 (sent under separate cover), 
the request.t and cookie.t tests are run, and all pass
(this is under ActivePerl 618, based on Perl-5.6.0).

best regards,
randy



Re: updated version of libapreq-win32

Posted by Doug MacEachern <do...@covalent.net>.
On Sun, 1 Oct 2000, Randy Kobes wrote:

> Hi,
>     Regarding the problem of the mod_perl tests
> not recognizing Apache::Cookie and Apache::Request
> on Win32 after they've been installed, as Jiho found,
> this was due to Win32 not having a populated 
> %callback_hooks in t/net/config.pl. For Unix
> systems, this information is appended to config.pl
> in the init_tests_and_config sub in the top-level 
> Makefile.PL, which is skipped on Win32. The patch
> below, applied to the current mod_perl cvs version,
> appends, for Win32, the %callback_hooks 
> to config.pl. With this patch, the tests for Apache::Cookie
> and Apache::Request are run on Win32 when these
> modules are installed (and all pass, with a suitably
> patched libapreq for Win32).

thanks randy.  how about this version of your patch, which just moves that
hunk of code into it's own routine, that's called by
init_tests_and_config() and by itself if $Is_Win32 ?

Index: Makefile.PL
===================================================================
RCS file: /home/cvs/modperl/Makefile.PL,v
retrieving revision 1.169
diff -u -r1.169 Makefile.PL
--- Makefile.PL	2000/09/27 17:55:21	1.169
+++ Makefile.PL	2000/10/02 20:32:44
@@ -865,6 +865,8 @@
     cp "t/net/config.pl.dist", "t/net/config.pl";
 }
 
+init_config_pl() if $Is_Win32;
+
 write_my_config($APACHE_SRC);
 
 unless($Is_Win32 or -e "t/conf/httpd.conf" or ($NO_HTTPD && !$PREP_HTTPD)) {
@@ -873,6 +875,32 @@
 
 init_tests_and_config() if $USE_APXS;
 
+sub init_config_pl {
+    my $mmn = magic_number($APACHE_SRC) || 0;
+
+    my $hf = FileHandle->new(">>t/net/config.pl") or 
+      die "can't open t/net/config.pl $!";
+
+    my $apaci_cfg = APACI->init;
+
+    my($k,$v);
+    my(%all) = %callback_hooks;
+    while (($k,$v) = each %experimental) {
+        $all{$k} = ($experimental{$k} > 1) ? 1 : 0;
+    }
+    print $hf "%callback_hooks = (\n";
+    while (($k,$v) = each %all) {
+        print $hf "   $k => $v,\n";
+        my $yes_no = $v ? "yes" : "no";
+        print $apaci_cfg "$k = $yes_no\n" if $apaci_cfg;
+    }
+    print $hf "   MMN => $mmn,\n";
+    print $hf "   USE_DSO => 1,\n" if $USE_DSO;
+    print $hf ");\n1;\n";
+    $hf->close;
+    $apaci_cfg->close if $apaci_cfg;
+}
+
 sub init_tests_and_config {
     local *FH;
     open FH, ">t/conf/dev-null";
@@ -913,31 +941,8 @@
 	    iedit "t/conf/httpd.conf", "s/^#(PerlOpmask)/\$1/";
 	}
     }
-    {
-	my $mmn = magic_number($APACHE_SRC) || 0;
-
-	my $hf = FileHandle->new(">>t/net/config.pl") or 
-	    die "can't open t/net/config.pl $!";
-
-	my $apaci_cfg = APACI->init;
 
-	my($k,$v);
-	my(%all) = %callback_hooks;
-	while(($k,$v) = each %experimental) {
-	    $all{$k} = ($experimental{$k} > 1) ? 1 : 0;
-	}
-	print $hf "%callback_hooks = (\n";
-	while(($k,$v) = each %all) {
-	    print $hf "   $k => $v,\n";
-	    my $yes_no = $v ? "yes" : "no";
-	    print $apaci_cfg "$k = $yes_no\n" if $apaci_cfg;
-	}
-        print $hf "   MMN => $mmn,\n";
-	print $hf "   USE_DSO => 1,\n" if $USE_DSO;
-	print $hf ");\n1;\n";
-	$hf->close;
-	$apaci_cfg->close if $apaci_cfg;
-    }
+    init_config_pl();
 
     if($USE_APACI and not $PREP_HTTPD and not $USE_APXS) {
 	my $shrpenv = $Config{shrpenv} || "";
@@ -1962,6 +1967,7 @@
 }
 
 sub APACI::init {
+    return undef if $Is_Win32;
     my $lib_cfg;
     if($USE_APXS) {
 	$lib_cfg = "apaci/mod_perl.config";


Re: updated version of libapreq-win32

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
Hi,
    Regarding the problem of the mod_perl tests
not recognizing Apache::Cookie and Apache::Request
on Win32 after they've been installed, as Jiho found,
this was due to Win32 not having a populated 
%callback_hooks in t/net/config.pl. For Unix
systems, this information is appended to config.pl
in the init_tests_and_config sub in the top-level 
Makefile.PL, which is skipped on Win32. The patch
below, applied to the current mod_perl cvs version,
appends, for Win32, the %callback_hooks 
to config.pl. With this patch, the tests for Apache::Cookie
and Apache::Request are run on Win32 when these
modules are installed (and all pass, with a suitably
patched libapreq for Win32).

best regards,
randy kobes

***************************************************
--- Makefile.PL.orig Wed Sep 27 17:18:10 2000
+++ Makefile.PL Sun Oct 01 15:16:18 2000
@@ -861,6 +861,23 @@
     }
 }
 
+if ($Is_Win32 and ! -e "t/net/config.pl") {
+  cp "t/net/config.pl.dist", "t/net/config.pl";
+  my $hf = FileHandle->new(">>t/net/config.pl") or 
+    die "can't open t/net/config.pl $!";
+  my($k,$v);
+  my(%all) = %callback_hooks;
+  while(($k,$v) = each %experimental) {
+    $all{$k} = ($experimental{$k} > 1) ? 1 : 0;
+  }
+  print $hf "%callback_hooks = (\n";
+  while(($k,$v) = each %all) {
+    print $hf "   $k => $v,\n";
+  }
+  print $hf ");\n1;\n";
+  $hf->close;
+}
+
 unless (-e "t/net/config.pl") {
     cp "t/net/config.pl.dist", "t/net/config.pl";
 }

***************************************************