Linking a shared library against a static library: must the static library be compiled differently than if an application were linking it?

后端 未结 3 2047
傲寒
傲寒 2020-12-13 09:42

At least on Linux and Solaris, static libraries are really just a bunch of compiled .o\'s tossed into one big file. When compiling a static library, usually the -fpic flag i

3条回答
  •  难免孤独
    2020-12-13 10:03

    As an alternative approach, ship two libraries: your shared one and the static you're linking against alongside. They should link into the final executable correctly.

提交回复
热议问题