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

Re: [Libevent-users] using libEvent 2.x with Visual C++



On Wed, Jun 6, 2012 at 12:55 AM, Patrick Pelletier
<ppelletier@xxxxxxxxxx> wrote:
> Sorry if this is a frequently asked question, but I haven't been able to
> find an answer in the documentation or mailing list archives.
>
> My ultimate goals are:
>
> - I'd like to use libEvent from an application built with Visual C++ 2010
> - I'd like libEvent to be a DLL (not a static library)
> - I want to use the OpenSSL integration
>
> I'm making the following assumptions:
>
> - I need to compile libEvent with the same compiler that I want to compile
> my own code with (since libEvent doesn't seem to have an equivalent to
> OpenSSL's "applink.c" that bridges between the two compilers' runtimes)

(I'd sure like to have one of those, fwiw.)

> - The "configure" script can only be used to build with MinGW or CygWin

It should work with any reasonably cc-like compiler on any reasonably
posix-like host.

This of course does -not- include MSVC.

> - Therefore, I need to use Makefile.nmake

Right, or make your own makefile, or make your own project file, or
make your own cmake file, or get somebody else to do one of those.

> - Besides having some scary comments at the top, Makefile.nmake currently
> doesn't work (failed with some undefined symbols like _evutil_gettimeofday
> when I tried it)

Hm.  What version of Libevent were you trying with?  Could you attach
the actual error you're getting?

The scary comments are mainly there because I don't know nmake and
msvc very well, and I don't want people thinking this is as polished
as the autoconf/automake build process.

> - Even if Makefile.nmake worked, it only builds static libraries, and
> doesn't build the OpenSSL integration

Correct.  I'd like to fix that, but my DLL expertise is extremely
limited.  Any help there would be much appreciated.

> My questions are:
>
> - Are all of my above assumptions/observations correct?
> - Are there others interested in using libEvent with Visual C++, or am I the
> only one?

Others have definitely been interested.

(BTW, it's "libevent", not "libEvent".)

> - Am I better off starting with the Makefile.nmake and fixing it, or would I
> be better off starting from scratch with something like CMake?

I'm not sure, since I don't know what's going to be required to make
it emit DLLs for you.  If it's easy to do that via Makefile.nmake, I'd
be in favor of it.

re cmake: From time to time people have tried to write cmakefiles for
Libevent.  I haven't accepted them as a replacement for the
autotools-based build process, since such efforts have inevitably
omitted multiple checks that the autotools build does.  But as an
*alternative* build process, it would be cool to have something like
that.  A little searching should find previous efforts in this area
that you might be able to build on.

> - Is the build system likely to be the main issue in getting libEvent to
> work with Visual C++, or is it expected that there will be issues with the
> code itself, in getting it to compile with Visual C++?

There may be small issues.  I have periodically tried to build
libevent with msvc, and it works okay for me, but it's likely there's
stuff I'm missing.  If there are such issues, let's fix them!

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