Restricting symbols in a Linux static library

后端 未结 5 746
逝去的感伤
逝去的感伤 2020-12-02 11:40

I\'m looking for ways to restrict the number of C symbols exported to a Linux static library (archive). I\'d like to limit these to only those symbols that are part of the

5条回答
  •  星月不相逢
    2020-12-02 12:14

    My way of doing it is to mark everything that is not to be exported with INTERNAL, include guard all .h files, compile dev builds with -DINTERNAL= and compile release builds with a single .c file that includes all other library .c files with -DINTERNAL=static.

提交回复
热议问题