Re: Evolution 0.6 "Procompsognathus" is out



On Wed, Oct 25, 2000 at 11:54:45PM -0400, D-Man wrote:
> I've always wondered what the numbering scheme is for the shared library files.  Would someone like to explain it?

Sure.

Libraries are meant to be used by other programs.  These other
programs must have a defined way of calling functions in the library.
The collection of all of these functions, plus associated types,
structures, etc is called the interface.

For example, I may write a simple library, called libfoo, that
provides the following interface:

foo_print_hello_world ()

This function prints "Hello, world." to stdout.

I compile this baby up, and distribute it to the world as
libfoo-0.1.tar.gz, which has the library file libfoo.so.1 in it.

A program that links against libfoo would then be able to (after
including the appropriate header files) call foo_print_hello_world, to
print "Hello, world."

But!  I discover that I failed to put a return at the end of the
string!  I quickly release libfoo-0.2.tar.gz, which now prints the
string "Hello, world.\n" to stdout.  But notice that the function,
foo_print_hello_world, still has the same API.

Now, I'm getting ambicious.  I decide to tweak libfoo to let it tell
people who's saying hello.

foo_print_hello_world (char *name)

This will now print "Hello world, says %s\n", where %s is the value of
name.  Notice that this is now a different API; when this function is
called from other programs, they must give a parameter.  If you try to
run a program linked against this older library, it will crash.

To prevent this, I make the new library libfoo.so.2.  The 2 means
that this is the second public interface we have provided.  This lets
the dynamic linker know that this library is not compatible with
libfoo.so.1, and that programs that link against libfoo.so.1 will not
be able to safely link against libfoo.so.2.

I can still release this new library, this time as libfoo-0.3.tar.gz,
but programs that use libfoo will have to be updated to use the new
interface.

I hope this very simplistic example helps.  ;)

(BTW please don't quote the entire message when replying next time --
I had to delete the entire Evolution announce message when replying to
you.)

-- 
Ian Peters
itp helixcode com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]