Stripping linux shared libraries

前端 未结 6 1976
醉梦人生
醉梦人生 2020-12-12 18:00

We\'ve recently been asked to ship a Linux version of one of our libraries, previously we\'ve developed under Linux and shipped for Windows where deploying libraries is gene

6条回答
  •  忘掉有多难
    2020-12-12 18:56

    Your use of the default visibility attribute and -fvisibility=hidden should be augmented with -fvisibility-inlines-hidden.

    You should also forget about trying to hide stdlib exports, see this GCC bug for why.

    Also, if you have all of your public symbols in a specific headers you can wrap them in #pragma GCC visibility push(default) and #pragma GCC visibility pop instead of using attributes. Though if you are creating a cross platform library, take a look at Controlling Exported Symbols of Shared Libraries for a technique to unify your windows DLL and Linux DSO export strategy.

提交回复
热议问题