Opened 5 years ago

Last modified 5 years ago

#13052 new Bugs

iostreams visibility=hidden for non-Windows platforms

Reported by: Mark M <mememory359@…> 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)

boost-fix-iostreams-visibility.patch (1.2 KB ) - added by anonymous 5 years ago.
boost-fix-locale-visibility.patch (966 bytes ) - added by anonymous 5 years ago.
boost-fix-iostreams-visibility.2.patch (1.2 KB ) - added by anonymous 5 years ago.
fixed version

Download all attachments as: .zip

Change History (5)

comment:1 by Mark M <mememory359@…>, 5 years ago

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.

by anonymous, 5 years ago

by anonymous, 5 years ago

comment:2 by anonymous, 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.

by anonymous, 5 years ago

fixed version

Note: See TracTickets for help on using tickets.