[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFC: proposal for indirect deplibs
From: |
Noah Misch |
Subject: |
Re: RFC: proposal for indirect deplibs |
Date: |
Wed, 24 Nov 2004 22:14:35 -0800 |
User-agent: |
Mutt/1.5.6i |
On Wed, Nov 24, 2004 at 07:47:54PM -0600, Bob Friesenhahn wrote:
> On Wed, 24 Nov 2004, Ralf Wildenhues wrote:
> >direct dependency:
> >A program or library has a direct dependency on a library, if it depends
> >on some interface that library provides, see node Interfaces for a more
> >thorough description.
>
> More classifications should applied for "direct dependency".
> Symbolic dependencies are obvious since the linker knows about them.
> Dependencies introduced by header files (library A uses headers and
> symbols from library B, but headers from library B include headers
> from library C) may introduce a dependency that the linker does not
> know about. How would this be handled?
Perhaps libtool libraries should distinguish base libraries that contribute to
their APIs. For example, if the headers for libfoo do a `typedef int foo_t' and
libbar uses foo_t from the libfoo headers in its own function parameters, libfoo
is an api-defining dependency of libbar. If libfoo defines `double mycos(double
angle);' using cos(3), libfoo has a normal dependency on libm. The .la for
libfoo might look like this (abridged):
--------
# for compatibility with older libtool
dependency_libs="-lfoo -lm"
api_dependency_libs="-lfoo"
normal_dependency_libs="-lm"
--------
For safety, libtool would assume that unadorned dependent libraries contribute
to the API. An option, say `-private-libs', would mark the start of normal
dependencies. For example, the link command for libbar might look like this:
libtool --mode=link cc bar.o... -o libbar.la -lfoo -private-libs -lm
Consider baz, an application that links with libbar. In Ralf's terms, libfoo is
then a direct base library of baz, and libm is an indirect base library.
When the linker is needed-following, libtool would explicitly link a product
(application or library) with all libraries it depends upon directly and all
api-defining dependencies of those libraries. API-defining would be transitive
in the natural way.