On Thu, Mar 15, 2012 at 3:10 AM, Gavin <wzy17695@gmail.com> wrote:
On Thursday, 15 March 2012 at 08:59:58 UTC, Gavin wrote:
How do I setup libcurl on Windows 7?
I want to use the functions from the std.net.curl module.

Here's what I did:

I downloaded the zip file from here http://curl.haxx.se/libcurl/d/
According to the instructions in the read-me file, I did as it said, and I copied the files to my project directory. However it did not work.

I can't seem to figure out what's wrong.

I forgot to say I'm using Visual Studio 2010, and Visual D

2.058 for Windows was released without std.net.curl built in. You'll have to rebuild phobos to get it working. It's not too hard though.

Download this version of libcurl which has an dmd-compatible OMF curl import library. https://github.com/downloads/D-Programming-Language/dmd/curl-7.24.0-dmd-win32.zip

Just drop the top level dmd2 folder right into wherever you installed D.  The directory layout matches D's installation so it'll put the dlls and the import library where they need to go.

Next, download a replacement for win32.mak from my branch that enables curl here: https://raw.github.com/eco/phobos/9c2f390be07927ef08a9d681924afcb90892b3cb/win32.mak 

Place that in D\dmd2\src\phobos\, overwriting the one that is already there.  Now open a command prompt to that same directory and type:

   make -f win32.mak unittest

The 'unittest' is optional and takes a lot longer but std.net.curl is checked so you'll get an early warning if something is wrong.  Finally, copy the resulting phobos.lib from the current directory into D\dmd2\windows\lib\, overwriting the one that is there.

If you want to distribute your application you'll need to include the curl dlls that are in the first download along with it.  Just dropping them in the same directory as your application should work fine (although its given us trouble with the autotester which is why this pull request hasn't been merged. I'm still trying to figure out what to do about it.).

Regards,
Brad Anderson