cURL / Mailing Lists / curl-library / Single Mail

curl-library

Make libcurl work under win32 with ares

From: codemastr <codemstr_at_ptd.net>
Date: Mon, 22 Dec 2003 17:54:21 -0500

Ok, since no one responded to me on how to get libcurl working under MSVC++
with ares support, I played around and figured it out. Listed here is what I
did to make it work, might not be the best way, maybe some have some
suggestions, but this did work.

First I compiled curl-ares. I changed the default C runtime library to be
the single-threaded rather than the multi-threaded (this seems to be
required to prevent linking errors later on). Then I simply build the
areslib project (the other projects adig/ahost seem to fail under MSVC).

Next was libcurl. I opened lib/config-win32.h and I added a:
 #define USE_ARES 1

Next thing I added was, near the HAVE_GETTIMEOFDAY checks I added:
#ifdef USE_ARES
#define HAVE_GETTIMEOFDAY 1
#endif

The reason is, it seems curl-ares has a gettimeofday function in it (perhaps
this should be made static in ares to avoid this kludge?) To prevent a
duplicate symbol error, I had to make sure libcurl didn't also try and
create a gettimeofday() function.

Next thing I did was I added the path for the ares includes to the include
path, and the libares.lib to the libraries.

Lastly, I also changed libcurl to be single-threaded rather than
multi-threaded, again this was to prevent some duplicate symbol errors. I'm
not sure why I needed to change everything to single-threaded, but when I
didn't I got redefinition errors for several CRT functions (malloc, stricmp,
etc.)

I would have modified the MSVC++ project files, but I only have VC.NET and
it uses a different format than VC6.0 so I didn't want to go and change
everything and remove VC6.0 support from libcurl.

Hope this helps anyone else looking to use libcurl with ares under Windows!

Dominick Meglio

-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
Received on 2003-12-22