Static libs not compiled -shared

I notice that the static libraries (/usr/lib/*.a) are not compiled
with the -shared option. This is a problem is you are creating a
dynamic library that depends on a static library. The dynamic library
(compiled and linked with -shared) works fine so long as it has no
dependencies into a static library, but crashes on load if it has any
dependencies into a static library, and has been linked against it.

I see two solutions to this problem:

  1. compile all static library objects with -shared
  2. make .so versions of static libraries available.

I personally like 2) better than 1). I am thinking (today, at least)
about /usr/lib/libPtFlash.a and /usr/lib/libPtWeb.a. Tomorrow there
will be others.

Any thoughts?

Andrew

Andrew Thomas <Andrew@cogent.ca> wrote:

I notice that the static libraries (/usr/lib/*.a) are not compiled
with the -shared option. This is a problem is you are creating a
dynamic library that depends on a static library. The dynamic library
(compiled and linked with -shared) works fine so long as it has no
dependencies into a static library, but crashes on load if it has any
dependencies into a static library, and has been linked against it.

I see two solutions to this problem:

  1. compile all static library objects with -shared
  2. make .so versions of static libraries available.

I personally like 2) better than 1). I am thinking (today, at least)
about /usr/lib/libPtFlash.a and /usr/lib/libPtWeb.a. Tomorrow there
will be others.

Any thoughts?

Yeah, this is a problem. Another solution is to ship another static
lib that has been compiled shared, (libcS.a is one of these)

You can also link in the static lib in to your main application, if this
is possible.


cburgess@qnx.com