[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] libevent 1.4.13 on Windows



On Sat, Jan 02, 2010 at 04:43:20PM -0500, Michael Lenaghan wrote:
> Hello, all.
> 
> I compiled libevent 1.4.13 on Windows (using the free Microsoft Visual
> C++ 2008 Express Edition) and ran into some issues that I thought I'd
> pass on.
> 
>  * The libevent.sln file doesn't work out of the box; it fails to load
> the test sub-projects because it's looking for .vcproj files that
> aren't there. (If you open the libevent.dsw file it will create the
> missing .vcproj files as it upgrades the project file.)

Right; the project files have been embarassingly unmaintained for far
too long.  For people who want to build with VC, future releases will
ship with nmake files, which (while being less convenient) should
actually build all the right files.

They've probably got issues too; interested people should have a look
at what we've got in Git and see how it needs to be improved.

>  * The project statically links the CRT using /MT and /MTd. In various
> places MS recommends that you dynamically link the CRT unless you
> "know what you're doing." Although dynamically linking the CRT using
> /MD and /MDd entails its own issues (with manifest files and such) I
> think that would still be a better default stance. (I've provided
> excerpts from two MS pages below that disciss static CRTs.) 

Sounds sensible. If we're doing it wrong in the nmake files, please
send a patch?

>  * The event.h file does this:
> 
> #ifdef WIN32
> #define WIN32_LEAN_AND_MEAN
> #include <windows.h>
> #undef WIN32_LEAN_AND_MEAN
> ...
> 
> I'd suggest only undefining WIN32_LEAN_AND_MEAN if event.h did the
> define in the first place; otherwise you might screw up other code.

Ouch; we do this in way too many places.  I've filed it as a bug in
the sourceforge tracker :
https://sourceforge.net/tracker/index.php?func=detail&aid=2925476&group_id=50884&atid=461322#


>  * The Windows code uses snapshots of config.h and event-config.h.
> They contain the wrong version number:
> 
> In config.h:
> 
> /* Version number of package */
> #define VERSION "1.3.99-trunk"
> 
> In event-config.h:
> 
> /* Version number of package */
> #define _EVENT_VERSION "1.3.99-trunk"

This should be fixed in git by now.

>  * The most interesting problem I ran into was the fact that Windows
> also has an event.h file. Depending on the order in which include
> directories are searched that can really screw you up. In my case I
> included evhttp.h; evhttp.h included event.h; and then the file I was
> compiling failed because ev_int64_t wasn't defined--despite the fact
> that it should have been. It took a bit of time to sort that out!

Ouch!  This should be better with Libevent 2.x, where all the include
files are prefixed with event2/; the old event.h is only there in
Libevent 2.x for backward compatibility, and evhttp.h doesn't include
it any longer.

> ===
> 
> I've noted a few small issues, but they were minor; I wanted to point
> out that getting libevent up and running on Windows was really quite
> easy. So: well done.

Glad to hear it!

-- 
Nick

***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.