Creating both static and shared C++ libraries

前端 未结 1 804
伪装坚强ぢ
伪装坚强ぢ 2021-01-12 13:59

I\'d like to build both static and shared libraries in a project.

I know that shared libraries need to be be created from objects compiled with -fpi

相关标签:
1条回答
  • 2021-01-12 14:18

    The common approach that I've seen is, in fact, compiling your source twice, once with PIC and once without. If you don't do that, you either wind up with PIC overhead in the static library, or a shared object that can't be relocated by the OS (effectively meaning it's NOT shared across multiple clients of the library).

    0 讨论(0)
提交回复
热议问题