Question

What does it mean for a library to be both static and shared? From what I've read, those two are mutually exclusive. People tend to define one as the opposite of the other.

But reading the configure options for LAME, I see this.

  $ ./configure --help
  `configure' configures lame 3.99.5 to adapt to many kinds of systems.
  [...]
  --enable-shared[=PKGS]  build shared libraries [default=yes]
  --enable-static[=PKGS]  build static libraries [default=yes]
  [...]
Was it helpful?

Solution

What those flags do is build both shared libraries and static libraries, they don't try and make a single library both static and shared.

As you say, they are "mutually exclusive" in a sense--no single file can be both a static and shared library.

On a Linux system enabling both static and shared library compilation would give you both a *.a and a *.so file, the *.so file is used for dynamic (shared) linking, while the *.a file is used for static linking.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top