Opened 12 years ago

Closed 12 years ago

#5283 closed Bugs (fixed)

Suspect BOOST_PYTHON_DECL missing from init_module()

Reported by: Roland Kay <roland.kay@…> Owned by: Dave Abrahams
Milestone: To Be Determined Component: python USE GITHUB
Version: Boost 1.46.0 Severity: Regression
Keywords: Cc:

Description

In the following code, extracted from libs/python/src/module.cpp, I think that "BOOST_PYTHON_DECL" has been omitted from the declaration of init_module(...). It was present in version 1.43 of Boost and without it I get unresolved symbol errors when linking against Boost::Python.

In summary, I suspect that the third line in the fragment below should read:

BOOST_PYTHON_DECL PyObject* init_module(PyModuleDef& moduledef, void(*init_function)())

My apologies if this has, in fact, been removed deliberately.

#if PY_VERSION_HEX >= 0x03000000

PyObject* init_module(PyModuleDef& moduledef, void(*init_function)())
{
    return init_module_in_scope(
        PyModule_Create(&moduledef),
        init_function);
}

#else

namespace
{
    PyMethodDef initial_methods[] = { { 0, 0, 0, 0 } };
}

BOOST_PYTHON_DECL PyObject* init_module(char const* name, void(*init_function)())
{
    return init_module_in_scope(
        Py_InitModule(const_cast<char*>(name), initial_methods),
        init_function);
}

Change History (1)

comment:1 by Ralf W. Grosse-Kunstleve, 12 years ago

Resolution: fixed
Status: newclosed

r70493 | rwgk | 2011-03-23 21:10:59 -0700 (Wed, 23 Mar 2011) | 1 line

libs/python/src/module.cpp: bug fix: adding missing BOOST_PYTHON_DECL that should have been in rev. 67462, fixes trac issue #5283


Note: See TracTickets for help on using tickets.