cURL / Mailing Lists / curl-library / Single Mail


Re: statically linking libcurl

From: Augustus Saunders <>
Date: Thu, 21 Apr 2005 14:11:54 -0700

You need to define CURL_STATICLIB in your project and make sure that the
curl libraries were built:

1) for static linking
2) with the same microsoft runtime that you're using

The default linking for libcurl uses the msvcrt.dll rather than
libcrt.lib even when compiling a static libcurl. To me, this seems
backwards--if somebody wants static linking, they probably want static
linking all the way around. At least, that's how I do it. If you build
using the makefiles, then you have to go in and edit the makefiles to
change this. Inside the lib directory, open up Makefile.vc6 and find
the cl.exe command line, you'll see the linkage option there, by default
/MD and /MDd for the debug version. You have to make sure these match
with your project or you're liable to get linker errors (I use /MT and
/MTd, respectively). Additionally, you have to make sure these linker
settings match *for every libarary libcurl links against*. So, you may
have to change openSSL, zlib, etc, if you use those options--I had to
modify openSSL's makefiles and rebuild it because of this.

Daniel, enough people have asked about static linking maybe we should
add some FAQs about it? Also, what's it take to make a binary distro of
libcurl with static-link options set? Obviously, there's sooo many
configurations that we probably can't provide them all, but we could
probably provide the most common handful.


chris neale wrote:

>My target users are not computer savvy and I want them to be able to
>download a stand-alone executable or something else that is very simple.
>Further, they mostly use public-access pcs running winXP and will not be
>able to put DLLs into the system32 directory.
>I have tried allowing them to download libcurl.dll (from my compilation)
>into their executable directory. While this works on some computers, it
>does not appear to work for all users.
>1. Do I need to give them additional dll's or perhaps they need to
>change their system settings to recognize dll's in the directory of the
>2. How can I statically link so that there is only a single required
>I am compiling on a windowsXP MSvisualStudio6, linking via the method
>outlined in
>What I currently have set up is available through a web-site:
Received on 2005-04-21