Skip to content
Snippets Groups Projects
Commit 206ce636 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

extern "C" for the main function

parent c4c2f5a2
No related branches found
No related tags found
No related merge requests found
......@@ -98,16 +98,21 @@ PyObject* error_out(
} // namespace python
} // namespace dynamicgraph
#ifdef __cplusplus
extern "C" {
#endif
#if PY_MAJOR_VERSION >= 3
PyMODINIT_FUNC PyInit_dynamic_graph(void)
PyMODINIT_FUNC PyInit_wrap(void)
#else
void initdynamic_graph(void)
void initwrap(void)
#endif
{
#if PY_MAJOR_VERSION >= 3
PyObject *module = PyModule_Create(&dynamicgraph::python::dynamicGraphModuleDef);
#else
PyObject *module = Py_InitModule("dynamic_graph", dynamicgraph::python::dynamicGraphMethods);
PyObject *module = Py_InitModule("wrap", dynamicgraph::python::dynamicGraphMethods);
#endif
if (module == NULL)
......@@ -124,3 +129,7 @@ PyObject* error_out(
return module;
#endif
}
#ifdef __cplusplus
} // extern "C"
#endif
......@@ -173,7 +173,7 @@ static PyMethodDef dynamicGraphMethods[] = {
__attribute__((unused))
static struct PyModuleDef dynamicGraphModuleDef = {
PyModuleDef_HEAD_INIT,
"dynamic_graph",
"wrap",
NULL,
sizeof(struct dynamicgraph::python::module_state),
dynamicGraphMethods,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment