[C++-sig] Boost Python: C++ struct with a function pointer

2010-03-02 Thread puneet goel
Greetings I am boost.python newbie. I tried searching the web for a solution but could not find one. I am trying to generate Python Bindings for a C++ API. The API has some data structures with a set function pointers as its members. struct foo { public: int a, b; char *str; int (*func1) (

Re: [C++-sig] Boost Python: C++ struct with a function pointer

2010-03-02 Thread Matthew Scouten (TT)
Not in any straight forward way. C++ function pointers need to exist at compile time, while python functions do not exist till runtime. You might have a few work abounds, depending on use. The most obvious is to hardwire the pointers to known c++ functions that call python functions after some k

Re: [C++-sig] Boost Python: C++ struct with a function pointer

2010-03-02 Thread Jim Bosch
On Tue, 2010-03-02 at 16:39 +0530, puneet goel wrote: > Greetings > > I am boost.python newbie. I tried searching the web for a solution but > could not find one. > I am trying to generate Python Bindings for a C++ API. The API has > some data structures with a set function pointers as its members

Re: [C++-sig] Boost Python: C++ struct with a function pointer

2010-03-02 Thread puneet goel
Mathew/Jim > If you just need your Python interface to support calling those function > pointers, not adding new functions in Python, it's relatively easy. Thanks for your support. Actually I need to pass data from Python to C++. I am required to pass Python functions as part of the structure i

Re: [C++-sig] Boost Python: C++ struct with a function pointer

2010-03-02 Thread Stefan Seefeld
On 03/02/2010 09:18 PM, puneet goel wrote: Mathew/Jim If you just need your Python interface to support calling those function pointers, not adding new functions in Python, it's relatively easy. Thanks for your support. Actually I need to pass data from Python to C++. I am required

Re: [C++-sig] Boost Python: C++ struct with a function pointer

2010-03-02 Thread Jim Bosch
On Wed, 2010-03-03 at 07:48 +0530, puneet goel wrote: > Mathew/Jim > > > If you just need your Python interface to support calling those function > > pointers, not adding new functions in Python, it's relatively easy. > > Thanks for your support. > > Actually I need to pass data from Python to C

Re: [C++-sig] Boost Python: C++ struct with a function pointer

2010-03-02 Thread puneet goel
> boost::python::object - it's just a smart pointer to an arbitrary Python > object (in the Python C-API, it's PyObject*).  It overloads operator() > to invoke the underlying Python object's __call__ method, and it's > templated to take a reasonable number of arbitrarily typed arguments, > convert