cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-library Mailing List Archives

Re: statically linking libcurl

From: Augustus Saunders <augustus.saunders_at_verilogix.net>
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.

Augustus

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
>executable?
>
>2. How can I statically link so that there is only a single required
>executable?
>
>I am compiling on a windowsXP MSvisualStudio6, linking via the method
>outlined in http://curl.haxx.se/libcurl/c/visual_studio.pdf
>
>What I currently have set up is available through a web-site:
>http://users.eastlink.ca/~hcap/bbblibrary.html
>
>
>
>
Received on 2005-04-21

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET