curl-library
Re: statically linking libcurl
Date: Sun, 24 Apr 2005 17:17:18 -0300
Thanks Augustus and others for your help.
I have been unsuccessful creating a statically linked executable. I have
the same problem with both MSvisualStudio (I eventually need a windows
program) and gcc in linux. I will focus on gcc since it is simpler to
describe. 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.
Adding #define CURL_STATICLIB to my c source code appears to be
identical to adding -DCURL_STATICLIB to my CFLAGS in the makefile. Using
both together yields:
>make -f makefile.bbl
gcc -static -c -DCURL_STATICLIB library.c
library.c:14:1: warning: "CURL_STATICLIB" redefined
library.c:1:1: warning: this is the location of the previous definition
gcc -o library library.o -L/home/chrisn/curl/curl-7.13.2/include/lib
-lcurl
Anyway, using either of these definitions alone yields no errors or
warnings, but the file size of the executable is 20kb whether or not I
attempt to statically link.
I have read some previous posts that suggest to compile curl using
--disable-shared, but also I have seen it mentioned that both the static
and dynamically linked libraries are produced with the regular
compilation. I have compiled curl simply by downloading it and typing
make.
Thanks again for everybody's help.
Chris Neale.
Received on 2005-04-24