LD script for symbol hidding in c++
问题 I would like to use an GNU LD version script to hide unwanted symbols in c++ shared library. Say my header file looks like this: int a(); int a(int); class B { B(){} ~B(){} int x(int); }; std::ostream& operator<< (std::ostream& out, const B& b ); I would like to hide everything which is not stated in the header file. How would a version script for this look like? 回答1: Something like this should do the trick: { global: extern "C++" { "a()"; "a(int)"; B::*; "operator<<(std::ostream&, B const&)"