Hide private symbols not hidden by default visibility
onitake opened this issue · comments
This is a followup to #80 .
While reviewing the symbols exported by libArcus, I found some that are not hidden by default, even though the default visibility is now set to hidden.
In particular, some symbols from Arcus::Socket::Private
are still exported, even though it doesn't look like they should be. This class implements the Pimpl pattern for Arcus::Socket
, which is (and should be) exported.
The symbols in question are:
Arcus::Socket::Private::fatalError(Arcus::ErrorCode::ErrorCode, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
Arcus::Socket::Private::sendMessage(std::shared_ptr<google::protobuf::Message> const&)
Arcus::Socket::Private::handleMessage(std::shared_ptr<Arcus::Private::WireMessage> const&)
Arcus::Socket::Private::receiveNextMessage()
Arcus::Socket::Private::checkConnectionState()
Arcus::Socket::Private::run()
Arcus::Socket::Private::error(Arcus::ErrorCode::ErrorCode, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
I do not know the cause for this, but after marking the private class with ARCUS_NO_EXPORT
, they are now hidden correctly.
I'm not sure why the Socket::Private symbols were still in the build. Indeed I've seen crashes in the past in Socket::Private from CuraEngine so it must've been exposed somewhere. I've tried your suggestion of explicitly hiding it and everything still works fine.
We've not really put a lot of effort into giving this a proper stable ABI. I think the PIMPL pattern was implemented mostly as an experiment. This library doesn't change very often after all. Since this change works for you and doesn't hurt for the rest, I'll merge it.
Thanks for the quick response!
I know that your main focus has always been on the Python library, and libArcus was more of a glue component for CuraEngine.
But it's always better to be a bit mindful about such things.
With these fixes, the exported symbols from the library are vastly reduced: https://salsa.debian.org/3dprinting-team/libarcus/blob/master/debian/libarcus3.symbols
There's still a minor discrepancy between gcc8 and gcc9, but it's much less than it was before.