Boost C++ Libraries: Ticket #2230: Wrapping Python function pointer https://svn.boost.org/trac10/ticket/2230 <p> It would be really usefull to be able to wrap python function pointer as the following example : </p> <p> typedef void (*fct_void_void)( void ); void addTimer( double dStartIn, double dTickTime, u32 iTickCount, fct_void_void bpFctCallback ) { </p> <blockquote> <p> ..... </p> </blockquote> <p> } BOOST_PYTHON_MODULE(ksys) { </p> <blockquote> <p> using namespace boost::python; def("addTimer", &amp;addTimer); </p> </blockquote> <p> } </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2230 Trac 1.4.3 Steven Watanabe Sun, 13 Jun 2010 03:30:45 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/2230#comment:1 https://svn.boost.org/trac10/ticket/2230#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> It isn't possible to convert a python function into a C function pointer, because a function pointer has no state. The closest you can get is to use the call operator of boost::python::object. See <a href="http://www.boost.org/libs/python/doc/v2/callbacks.html">http://www.boost.org/libs/python/doc/v2/callbacks.html</a>. </p> Ticket