Skip to content

Fails to export PyInit_MODULE when compiling with hidden visibility #169

@xnox

Description

@xnox

It seems like BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY is gone in boost1.65.1 but is still referenced in module_init.hpp. This results in failure to export PyInit_mymodule when compiling with hidden visibility and g++.

I have worked around this by add -DBOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY=1 in my sources. But previous boost did the right thing here.

Maybe the condition path elif BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY can be dropped, adn the default fall through should be adjusted to become:

-extern "C" _BOOST_PYTHON_MODULE_INIT(name)
+extern "C" BOOST_SYMBOL_EXPORT _BOOST_PYTHON_MODULE_INIT(name)

As BOOST_SYMBOL_EXPORT defines the right thing for the right compiler, for g++ it adds __attribute__((__visibility__("default"))) no? or maybe use BOOST_SYMBOL_VISIBLE ?

I will provide a short sample and build logs.

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