cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Using HTTPS in multi-threaded dynamic library plugin on CentOS

From: Jamie Lokier <jamie_at_shareable.org>
Date: Thu, 15 Apr 2010 21:59:26 +0100

Adal Chiriliuc wrote:
> I have pulled the libcurl *.c files into my project and I build it together with my code. No intermediary libcurl.a is built.
>
> -fPIC is used. The gcc flags are: -m32 -fno-strict-aliasing -ggdb -c -O2 -fPIC -MMD -MP -MF. I also define CURL_STATICLIB
> Linker flags: -lrt -ldl -lz -lidn -lcrypto -lssl
>
> > Are you statically linking the CentOS supplied on into your .so, or
> > having the main application link to both your .so and the CentOS
> > dynamic libcurl.so?
>
> Running ldd against my .so or the main application doesn't list
> libcurl. Is there a way to link against a lib on linux without using
> -l as above?

It can be given on the linker command line as the file to link instead
of -l, and it can be pulled in as a dependency of another library, and
it can be mentioned in the linker script. libcurl is unlikely to be
in the system linker script though.

> > If you are linking libcurl.a statically into your .so, I can imagine
> > obscure problems due to lack of -fPIC in libcurl.a's code. But more
> > likely, if you're doing that, perhaps the main application or some
> > other library used by the main application links to libcurl.so as
> > well, making multiple instances of libcurl in the same application?
>
> That's what I'm thinking. But if I don't link the libcurl c files
> into my dynamic library, the plugin can't be loaded because of missing
> imports. If something else linked to libcurl.so, wouldn't the plugin
> be loaded without a problem?

Not if they use different libcurl versions containing some different symbols.

-- Jamie
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-04-15