File tree 1 file changed +7
-2
lines changed 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -308,14 +308,19 @@ extern "C" {
308
308
}
309
309
\endrst */
310
310
#if PY_MAJOR_VERSION >= 3
311
+ #define PYBIND11_MODULE_DETAIL_STATIC_DEF (name ) \
312
+ static PyModuleDef PYBIND11_CONCAT (pybind11_module_def_, name);
311
313
#define PYBIND11_MODULE_DETAIL_CREATE (name ) \
312
- static PyModuleDef mdef; \
313
- auto m = pybind11::module(PYBIND11_TOSTRING(name), nullptr , &mdef);
314
+ auto m = pybind11::module( \
315
+ PYBIND11_TOSTRING (name), nullptr, \
316
+ &PYBIND11_CONCAT(pybind11_module_def_, name));
314
317
#else
318
+ #define PYBIND11_MODULE_DETAIL_STATIC_DEF (name )
315
319
#define PYBIND11_MODULE_DETAIL_CREATE (name ) \
316
320
auto m = pybind11::module(PYBIND11_TOSTRING(name));
317
321
#endif
318
322
#define PYBIND11_MODULE (name, variable ) \
323
+ PYBIND11_MODULE_DETAIL_STATIC_DEF (name) \
319
324
PYBIND11_MAYBE_UNUSED \
320
325
static void PYBIND11_CONCAT(pybind11_init_, name)(pybind11::module &); \
321
326
PYBIND11_PLUGIN_IMPL (name) { \
You can’t perform that action at this time.
0 commit comments