Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#63 pyinit.swg problem with Python3

closed
nobody
None
5
2009-02-28
2009-02-25
Thierry BERNARD
No

In pyinit.swg file SWIG_module structure is declared and initialized after the call of SWIG_Python_FixMethods method. c compiler don't accept this.
We have to replace this code with something like this ( structure declared before the call of SWIG_Python_FixMethods method ) :

SWIG_init(void) {
PyObject *m, *d;

#if PY_VERSION_HEX >= 0x03000000
static struct PyModuleDef SWIG_module = {
PyModuleDef_HEAD_INIT,
(char *) SWIG_name,
NULL,
-1,
SwigMethods,
NULL,
NULL,
NULL,
NULL
};
#endif

/* Fix SwigMethods to carry the callback ptrs when needed */
SWIG_Python_FixMethods(SwigMethods,swig_const_table, swig_types, swig_type_initial);
#if PY_VERSION_HEX >= 0x03000000
m = PyModule_Create(&SWIG_module);
#else
m = Py_InitModule((char *) SWIG_name, SwigMethods); #endif
d = PyModule_GetDict(m);

SWIG_InitializeModule(0);
SWIG_InstallConstants(d,swig_const_table);

Discussion

  • Haoyu Bai
    Haoyu Bai
    2009-02-28

    • status: open --> closed
     
  • Haoyu Bai
    Haoyu Bai
    2009-02-28

    Fixed in SVN commit 11140. Thanks!