yaml-cpp
yaml-cpp copied to clipboard
Export only YAML_CPP_API-tagged symbols on Linux.
Mark classes tagged with YAML_CPP_API with visibility("default"), to explicitly export them, and then hide everything else via -fvisibility=hidden
.
This reduces the number of exported symbols by more than 50%, which has a small application start-up time and memory useage benefit. It also makes it more feasible to audit the set of exported symbols in automated ABI compatibility systems.
In addition to running the unit-tests I've also built all of the packages in Ubuntu which depend on yaml-cpp against the it. All of them (at least the ones which don't fail for other reasons, like not using C++11) build fine against this, so those symbols are really unused.
@RAOF For Windows the classes shouldn't be tagged with YAML_CPP_API but the public methods. Will that conflict with Linux in any way? Which is something I intend to submit soon.
#958 seems related and especially I think letting cmake handle this is good idea. https://github.com/jbeder/yaml-cpp/pull/958#issuecomment-759639237