cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Dynamic linking to libcurl on linux

From: Arvind Sachdeva <asachdeva_at_gmail.com>
Date: Mon, 29 Nov 2004 21:05:09 +0530

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. But I see some os's have libcurl.so.2 while others have
libcurl.so.3. 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.

Can you point me to documents that explain waht is this 'x' thingy in
libcurl.so.x ? If what I understand out of this scheme is true then
while using this scheme how is the compatibility with lower versions
maintained. There is concept of versioned symbols isnt that a better
way of providing newer versions ?

> backwards compatible. If your app is smart enough, it could dynamically
> configure itself to work with other .x suffixes, but it's probably not
> worth the hassle.

On Thu, 11 Nov 2004 13:55:11 -0800, Dan Fandrich <dan_at_coneharvesters.com> wrote:
> On Thu, Nov 11, 2004 at 01:06:13PM -0800, Jeff Phillips wrote:
>
>
> > If I?m creating code that dynamically links at runtime to libcurl, should I
> > pass ?libcurl.so? or ?libcurl.so.x? as the first argument to dlopen()? I?d
> > prefer ?libcurl.so?. Do standard linux installations of libcurl create a
> > symbolic link to the latest and greatest libcurl.so.x? I look forward to
> > hearing from you linux gurus.
>
> It should link to 'libcurl.so.3'. /sbin/ldconfig is responsible for
> creating a link from libcurl.so.3.0.0 to that name at installation time.
> You need the .3 in there to ensure that you're loading the correct
> library; other numbers will be for versions that are not necessarily
> backwards compatible. If your app is smart enough, it could dynamically
> configure itself to work with other .x suffixes, but it's probably not
> worth the hassle.
>
> libcurl.so, when it exists, is a symbolic link to the version to which the
> linker will link a program at compile time; that's not the name you want.
>
> >>> Dan
> --
> http://www.MoveAnnouncer.com The web change of address service
> Let webmasters know that your web site has moved
>
Received on 2004-11-29