cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Dynamic linking to libcurl on linux

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Mon, 29 Nov 2004 20:22:46 +0100 (CET)

On Mon, 29 Nov 2004, Arvind Sachdeva wrote:

> I am linking (not using dlopen) my program with libcurl.so, which is a
> symbolic link to libcurl.so.2 . I want my binary to run on most of the
> OS's.

Do you mean "most of the Mac OS X" versions?

> But I see some os's have libcurl.so.2 while others have libcurl.so.3.

There was also a libcurl.so.1 before the 2 and there will eventually be a 4
and most likely a 5 too in the future...

> This becomes a sad situation because I get an error that Program failed to
> load while trying to look for liburl.so.2 which is a very sad situation, I
> dont want to relink my program for these other OS's. Is there a way my
> program works with almost all libcurl.so.x.

Yes, you should simply link with "-lcurl" to let the linker take care of using
the exact numerical version.

> Can you point me to documents that explain waht is this 'x' thingy in
> libcurl.so.x ?

It is the API number. We increase the number when we change the API in a
manner that isn't backwards compatible.

> If what I understand out of this scheme is true then while using this scheme
> how is the compatibility with lower versions maintained.

A program that is compiled and linked to a specific numeric version should
keep using that version. When the program is rebuilt, it should use the
highest number.

> There is concept of versioned symbols isnt that a better way of providing
> newer versions ?

What concept is that and how does that work across multiple operating systems
better than what libtool does?

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-11-29