Opened 5 years ago
Last modified 5 years ago
#13052 new Bugs
iostreams visibility=hidden for non-Windows platforms
Reported by: | Owned by: | Jonathan Turkanis | |
---|---|---|---|
Milestone: | To Be Determined | Component: | iostreams |
Version: | Boost 1.64.0 | Severity: | Problem |
Keywords: | Cc: |
Description
For the Mac, I am compiling the Boost libraries and my code using visibility=hidden. My code cannot find "boost::iostreams::zlib::default_compression". This is defined in iostreams/filter/zlib.hpp as Code: BOOST_IOSTREAMS_DECL extern const int default_compression;
The only place that BOOST_IOSTREAMS_DECL is defined is iostreams/detail/config/dyn_link.hpp. That file sets the macro to either Windows-specific settings (declspec(dllexport)), or leaves it blank. So the Boost iostreams library will have the wrong visibility settings.
This is unlike other places in the Boost code, where the right visibility settings are obtained by defining the library DECL macro as BOOST_SYMBOL_EXPORT. (Take a look at filesystem/config.hpp as an example of how it is done for most of the other libraries.)
Attachments (3)
Change History (5)
comment:1 by , 5 years ago
by , 5 years ago
Attachment: | boost-fix-iostreams-visibility.patch added |
---|
by , 5 years ago
Attachment: | boost-fix-locale-visibility.patch added |
---|
comment:2 by , 5 years ago
Add patches, which fix helps us to compile boost (1.64.0 tag version) with -fvisibility=hidden
and don't shadow interface.
Found another case where the settings are only valid for Windows, in the Locale library.
In locale/definitions.hpp, it is required that BOOST_HAS_DECLSPEC is defined before doing the rest of the code. This is only true for win32 (platform) and gcc (compiler). Since I'm using macosx/clang, this is another case were I won't be able to get the right visibility=hidden settings.