From 05bc1ffbe0192fbb7c52f4e33667e0c35fb9ba2c Mon Sep 17 00:00:00 2001 From: Alexander Stukowski Date: Fri, 13 Jan 2017 11:12:22 +0100 Subject: [PATCH] Correct function signature of module init function generated PYBIND11_PLUGIN_IMPL macro for Python 2.x (#602) --- include/pybind11/common.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/pybind11/common.h b/include/pybind11/common.h index d0af5728..ce0c2ed4 100644 --- a/include/pybind11/common.h +++ b/include/pybind11/common.h @@ -139,7 +139,11 @@ #define PYBIND11_STR_TYPE ::pybind11::bytes #define PYBIND11_OB_TYPE(ht_type) (ht_type).ob_type #define PYBIND11_PLUGIN_IMPL(name) \ - extern "C" PYBIND11_EXPORT PyObject *init##name() + static PyObject *pybind11_init_wrapper(); \ + extern "C" PYBIND11_EXPORT void init##name() { \ + (void)pybind11_init_wrapper(); \ + } \ + PyObject *pybind11_init_wrapper() #endif #if PY_VERSION_HEX >= 0x03050000 && PY_VERSION_HEX < 0x03050200