Skip to content

BOOST_SYMBOL_IMPORT should not be defined to nothing #362

Description

@Flamefire

For non-Win32 platforms BOOST_SYMBOL_IMPORT is defined to nothing which is wrong:

https://gcc.gnu.org/wiki/Visibility

Symbol visibility is "default" by default but if the linker encounters just one definition with it hidden - just one - that typeinfo symbol becomes permanently hidden (remember the C++ standard's ODR - one definition rule).

Hence (all being build with hidden visibility) a program using a boost shared library will not see e.g. the same typeinfo as the Boost lib which results in e.g. failure of being able to catch or dynamic_cast the class.

I observed this behavior on OSX, on Linux it seems harder to reproduce. See also https://stackoverflow.com/questions/65951466/why-can-a-thrown-exception-with-hidden-visibility-still-be-caught for more details

Solution: Define BOOST_SYMBOL_IMPORT to BOOST_SYMBOL_VISIBLE when BOOST_SYMBOL_EXPORT is too.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions