Using a specific version of a dynamic library - how?

From: Thomas Aho (my_spam_at_bluewin.ch)
Date: 05/08/04

  • Next message: Paul Pluzhnikov: "Re: Using a specific version of a dynamic library - how?"
    Date: 8 May 2004 08:03:47 -0700
    
    

    Hi all,
    Is there a way to link my application in a way, which makes it select
    a certain version of a dynamic library at run-time?

    Say for example that I write an application and use qt 3.1.2. I want
    to be
    able to install the binary on a server from where everyone in my
    organization
    can run it. A precondition is then of course that they have the
    qt-mt.so.3.1.2
    or qt-mt.so.3.1 somewhere in their LD_LIBRARY_PATH.
    The problem is that if there is also a newer version of qt installed
    on their
    system, /usr/lib/qt-mt.so will be linked to for example
    qt-mt.so.3.2.2. When
    starting my application, it will load the 3.2.2 version of qt-mt,
    which fails.
    What I simply would like to do is to link my application in a way
    which makes
    it "look for 3.1.2; if there is no 3.1.2, look for 3.1; if there is no
    3.1, look for 3, ...".
    The only possiblity I currently have is to give a directory to the
    linker, and it will look in that directory first for libs (e.g.
    /usr/lib/qt-3.1.2/lib). That however requires that all users have qt
    3.1.2 installed in that directory, which is a bit lot to require from
    someone who is not developing qt applications. I would rather just
    like to copy qt-mt.so.3.1.2 to /usr/lib.

    Is it possible to do what I want?

    /Thomas


  • Next message: Paul Pluzhnikov: "Re: Using a specific version of a dynamic library - how?"