[C++-sig] How to wrap a python function pointer ?

william marié william.marie at gmail.com
Wed Aug 20 09:37:27 CEST 2008


Hi,

Ok ticket created : http://svn.boost.org/trac/boost/ticket/2230
Thanks
bye
William

2008/8/20 David Abrahams <dave at boostpro.com>

>
> on Mon Aug 18 2008, William Marié <william.marie-AT-gmail.com> wrote:
>
> > I would like to wrap a python function pointer to a void (*c++fun)()
> pointer
> > :
> >
> > typedef void (*fct_void_void)( void );
> > void addTimer( double dStartIn, double dTickTime, u32 iTickCount,
> > fct_void_void bpFctCallback )
> > {
> >  .....
> >
> > }
> > BOOST_PYTHON_MODULE(ksys)
> > {
> >       using namespace boost::python;
> >       def("addTimer", &addTimer);
> > }
>
> Hi,
>
> Sorry, but right now we don't have a good solution for that use case.
> The best I can offer immediately is that you define a small struct that
> holds a fct_void_void, expose that to Python as usual, and then create a
> thin wrapper for addTimer that takes the struct instead of the function
> pointer.
>
> This could be fixed, though.  Would you care to open a trac ticket at
> http://svn.boost.org
>
>
> --
> Dave Abrahams
> BoostPro Computing
> http://www.boostpro.com
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org <C%2B%2B-sig at python.org>
> http://mail.python.org/mailman/listinfo/c++-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20080820/da5b68ee/attachment.htm>


More information about the Cplusplus-sig mailing list