Skip Menu |

This queue is for tickets about the Event-Lib CPAN distribution.

Report information
The Basics
Id: 7496
Status: open
Priority: 0/
Queue: Event-Lib

People
Owner: VPARSEVAL [...] cpan.org
Requestors:
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.02
Fixed in: (no value)



Subject: Lib.xs fixup for win32
--- Lib.xs 2004-08-26 23:22:29.000000000 -0700 +++ Lib.xs.new 2004-08-27 06:27:27.875000000 -0700 @@ -1,11 +1,19 @@ +#include <event.h> +#ifdef WIN32 +#undef read +#undef write +#else +#include <sys/time.h> +#endif + + #include "EXTERN.h" #include "perl.h" #include "XSUB.h" + #include "ppport.h" -#include <sys/time.h> -#include <event.h> #include "const-c.inc" @@ -78,7 +86,13 @@ tv->tv_usec = (t - (long)t) * 1e6f; } -inline double delta_timeval (struct timeval *t1, struct timeval *t2) { +#ifdef WIN32 +#define THEINLINE __forceinline +#else +#define THEINLINE inline +#endif + +THEINLINE double delta_timeval (struct timeval *t1, struct timeval *t2) { double t1t = t1->tv_sec + (double)t1->tv_usec / 1e6f; double t2t = t2->tv_sec + (double)t2->tv_usec / 1e6f; return t2t - t1t;
[guest - Fri Aug 27 09:29:53 2004]: Show quoted text
> --- Lib.xs 2004-08-26 23:22:29.000000000 -0700 > +++ Lib.xs.new 2004-08-27 06:27:27.875000000 -0700 > @@ -1,11 +1,19 @@ > +#include <event.h> > +#ifdef WIN32 > +#undef read > +#undef write > +#else > +#include <sys/time.h> > +#endif > + > + > #include "EXTERN.h" > #include "perl.h" > #include "XSUB.h"
The #include order was a bit off. event.h must be included late (i.e. after the Perl headers) so that u_char is defined. Show quoted text
> > + > #include "ppport.h" > > -#include <sys/time.h> > -#include <event.h> > > #include "const-c.inc" > > @@ -78,7 +86,13 @@ > tv->tv_usec = (t - (long)t) * 1e6f; > } > > -inline double delta_timeval (struct timeval *t1, struct timeval *t2) > { > +#ifdef WIN32 > +#define THEINLINE __forceinline > +#else > +#define THEINLINE inline > +#endif > + > +THEINLINE double delta_timeval (struct timeval *t1, struct timeval > *t2) { > double t1t = t1->tv_sec + (double)t1->tv_usec / 1e6f; > double t2t = t2->tv_sec + (double)t2->tv_usec / 1e6f; > return t2t - t1t;
I also added THEINLINE for make_timeval.
Show quoted text
> The #include order was a bit off. event.h must be included late (i.e. > after the Perl headers) so that u_char is defined.
The order was changed on purpose. It won't compile on win32 unless you bring in event.h before you bring in all the perl headers. solve how you wish :) You should also know that (perldoc perlport) open to |- and -| are unsupported. (Mac OS, Win32, RISC OS) You should try using IPC::Open2/3 (are in core) or IPC::Run . Also, there is no SIGHUP on win32, so signal.t should be testing to see if SIGHUP is define, otherwise skip ? or die, whatever is appropriate, because I don't know if that part of libevent even works on win32, or even if its supposed to, but it certainly does compile