The win32 builds of libcurl available on the Curl download page have way too many library dependencies (openldap/zlib/openssl etc). That makes sense since curl supports fetching resources using any of those those protocols. However, if all you want to do is just use curl for http use in your program, its simply better to compile the libcurl source to get the tiny libcurl library you need.
The below assumes that you have downloaded and installed mingw and you have mingw32-make in your PATH.
- Grab the libcurl source from the download page. I took curl-7.17.1.zip.
- Extract to a directory (preferably without spaces). We'll call this LIBCURL_HOME
- Open LIBCURL_HOME/lib/setup.h. Add a "#define HTTP_ONLY" (minus quotes ofcourse) just before the first line in the file. This disables all protocols except http. Read LIBCURL_HOME/docs/INSTALL for further information.
- Open a command shell, change to this directory and use command "mingw32-make mingw32". (Read LIBCURL_HOME/docs/INSTALL for more info on this)
- After compilation is finished, you should have 'libcurldll.a' and 'libcurl.a' present in LIBCURL_HOME/lib
- Change directory to LIBCURL_HOME/docs/examples. We'll now attempt to compile and run the simples libcurl example program 'simple.c'
- Run "gcc -DCURL_STATICLIB -I ..\..\include simple.c ..\..\lib\libcurl.a -lws2_32 -lwinmm -o simple" at the command line. Alternatively you can run
"gcc -DCURL_STATICLIB -I ..\..\include simple.c -L..\..\lib -lcurl -lws2_32 -lwinmm -o simple.exe".(See Curl FAQ)
- A file 'simple.exe' should be produced. Running this dumps the home page of curl to stdout as shown below
- ws2_32 is the winsock library (you can also do -lwsock32), winmm is a library for windows multimedia - as far as I can see there is only one time function used from this library