[C++-sig] Problem with PyMethodDef and non-static functions

Jon Kristensen jon.kristensen at dedikerad.se
Thu Sep 28 20:23:35 CEST 2006


Hello list!

I'm using Python/C to be able to have simple Python scripts in my
application. I was free of problems until I switched from using static
and global functions to using non-static class methods:

python.cpp:101: error: argument of type ‘PyObject* (Python::)(PyObject*,
PyObject*)’ does not match ‘PyObject* (*)(PyObject*, PyObject*)’

After some time I understood that this was a problem that a little
tweaking around wouldn't solve. So I want to ask you guys if you can
describe how to get around this. I wouldn't want to add any additional
dependencies such as SWIG or Boost. Please also note that I'm not that
experienced with Python.

And I want to keep this as clean/simple as possible! :-)

Thanks in advance!

-- 
Jon Kristensen




More information about the Cplusplus-sig mailing list