[C++-sig] Adding custom C API functionality to boost.python modules

Marcus Jannes jannes80 at hotmail.de
Mon Feb 11 15:09:38 CET 2008


Hello,sorry if this is an obvious thing to do, but how can i
access Python C API from boost.python. Say i want to add the following
code to a boost.python module://C API Function: static PyObject* foo(PyObject *self, PyObject *args){ /*some code */};//C API Method table:static PyMethodDef mod_methods[] = { {"py_foo",foo,METH_VARARGS,foo_doc},{NULL,NULL} };//init:void init(){   PyInitModule3("modulename", mod_methods, mod_doc);}--------------------------------------------------------------------------------------The remaining module code is written as usual:#include "boost/python.hpp"BOOST_PYTHON_MODULE(modulename){/* usual boost.python stuff */};Thanks
_________________________________________________________________
Importieren Sie ganz einfach Ihre E-Mail Adressen in den Messenger!
http://messenger.live.de/community/neuekontakte_adressimport.html


More information about the Cplusplus-sig mailing list