Thread: Shared libs with version numbers.

Shared libs with version numbers.

From
darrenk@insightdist.com (Darren King)
Date:
Silly question since I work with aix and it doesn't appear to use
the version numbers for shared libs...

Is there any purpose to the version numbers that some ports append
to a shared lib name, besides keeping different versions around?

I've managed to move the port specific code from all of the various
interfaces that make shared libs, but I'd like to understand the
rhyme/reason before I post a patch that breaks all other ports.

Using libpq as an example, is there a difference to the system if...

$(MAKE) libpq.so
$(INSTALL) libpq.so libpq.so.1
$(LN) libpq.so.1 libpq.so

...rather than...

$(MAKE) libpq.so.1
$(INSTALL) libpq.so.1 libpq.so.1
$(LN) libpq.so.1 libpq.so

???

If no difference to the system, the former is _much_ easier to add
shared lib support for aix and use the %.$(DLSUFFIX) rules in the
port Makefiles.

This would be perhaps the final step to removing $(PORTNAME) from the
code, these Makefiles would not have to be generated by configure, and
makes the interfaces/* Makefiles much cleaner.

darrenk

Re: [HACKERS] Shared libs with version numbers.

From
Michael Meskes
Date:
Darren King writes:
> Is there any purpose to the version numbers that some ports append
> to a shared lib name, besides keeping different versions around?

Yes. Making sure your application doesn't load an incompatible version of
the lib.

> Using libpq as an example, is there a difference to the system if...
>
> $(MAKE) libpq.so
> $(INSTALL) libpq.so libpq.so.1
> $(LN) libpq.so.1 libpq.so
>
> ...rather than...
>
> $(MAKE) libpq.so.1
> $(INSTALL) libpq.so.1 libpq.so.1
> $(LN) libpq.so.1 libpq.so

No. The file the system knows is libpq.so.1 either way. You might even call
it foo.bar in your Makefile as long as it is installed as libpq.so.1.

Michael

--
Dr. Michael Meskes, Project-Manager    | topsystem Systemhaus GmbH
meskes@topsystem.de                    | Europark A2, Adenauerstr. 20
meskes@debian.org                      | 52146 Wuerselen
Go SF49ers! Go Rhein Fire!             | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux!                  | Fax: (+49) 2405/4670-10

Re: [HACKERS] Shared libs with version numbers.

From
Tom Ivar Helbekkmo
Date:
darrenk@insightdist.com (Darren King) writes:

> Is there any purpose to the version numbers that some ports append
> to a shared lib name, besides keeping different versions around?

Well, no.  That _is_ the point.  Sort of.  Version numbers make it
possible to have different generations of shared libraries installed,
and have different binaries use different ones.  You can then install
a new version of the library -- and nothing will use it.  Once you
recompile some binary, though, it will henceforth dynamically link
against the new one, i.e. the one that it was built for.  This is, of
course, important because it allows the interface to change when the
version changes, without forcing you to recompile _everything_.

-tih
--
Popularity is the hallmark of mediocrity.  --Niles Crane, "Frasier"