cURL / Mailing Lists / curl-library / Single Mail


Re: statically linking libcurl

From: Daniel Stenberg <>
Date: Tue, 26 Apr 2005 15:58:33 +0200 (CEST)

On Sun, 24 Apr 2005, Chris Neale wrote:

> I have judged whether or not a statically linked executable has been
> produced based only on file size since, without another computer, I do not
> know how to actually test for static linking in an otherwise functional
> executable.

In Linux/Unix you can 'ldd curl' to see what dynamic libs it needs (or not).

> Adding #define CURL_STATICLIB to my c source code appears to be identical to
> adding -DCURL_STATICLIB to my CFLAGS in the makefile.

On Linux, neither has any particular impact.

> I have read some previous posts that suggest to compile curl using
> --disable-shared

configure --disable-shared will have you build a static libcurl only.

> but also I have seen it mentioned that both the static and dynamically
> linked libraries are produced with the regular compilation.

That is correct.

> I have compiled curl simply by downloading it and typing make.

If you do that on a linux/unix it runs a default configure and it thus will
build both a static and a shared libcurl.

You then decide which one to use when you link your application.

  Commercial curl and libcurl Technical Support:
Received on 2005-04-26