[Top][All Lists]

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

Re: static vs. shared libraries

From: Ralf Wildenhues
Subject: Re: static vs. shared libraries
Date: Mon, 9 Jun 2008 19:37:37 +0200
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

* John Calcote wrote on Mon, Jun 09, 2008 at 07:23:31PM CEST:
> Ideally, I'd like to build both shared and static ftk libraries, but
> choose to link ftk statically into flaim using a flaim configure option.

Why?  (serious question)

1) If ftk does not have a stable API yet, it is not suitable as
independent shared library; you should build a static one only
(either as lib_LIBRARIES = libftk.a, or, with libtool using
libftk_la_LDFLAGS = -static)

2) If ftk does have a stable API, then why waste space in flaim by not
using the shared library?

3) There may be serious reasons for doing what you want (not many tho).
In that case, you could consider creating separately a libftk_static.a
or a (static) convenience archive to which you link
flaim.  Let me repeat that this is often not the right thing to do.
Mixing static and shared variants of the same code leads to trouble
in the long run; example: flaim depends on libfoo which depends on
libftk (shared); flaim incorporates code from libftk (static).  All
kind of "interesting" errors ensue ...

> Is there any elegant way to do this, or is there some reason why doing
> so is considered bad practice? I've found over the years that if
> something's not easily possible, it's usually because it's not the right
> thing to do.

Good thinking.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]