Re: [pygccxml-development] Help needed with embedding
Brought to you by:
mbaas,
roman_yakovenko
From: Roman Y. <rom...@gm...> - 2009-08-04 12:10:17
|
On Tue, Aug 4, 2009 at 2:02 PM, Berserker<ber...@ho...> wrote: > I don't understand why do you think that this question should be posted in > the Boost.Python mailing list. Sorry, it seems that I need few more hours to sleep > "allow_threads" is just the code extracted from > http://libtorrent.svn.sourceforge.net/viewvc/libtorrent/trunk/bindings/python/src/gil.hpp?revision=2460&view=markup > , > maybe a property like "adaptor" or "visitor" for each Py++ function would do > the work, but I'm not so skilled with the Py++ API and probably there are > other better solutions, btw something like: > >> tm = foo_class.mem_fun( 'test_method' ) >> tm.adaptor = "my_adaptor" > > and then Py++ will create: > >> boost::python::class_< Foo >("Foo") >> .def("test_method_1", my_adaptor(&Foo::test_method_1)) > > Another solution (probably more "clean") could be a list of Templates for > each boost::python API (boost::python::class_::def, > boost::python::class_::add_property ecc...) so that we can customize them, > what about? Let me think about it. I will back to you in a day or two. I need to check how it could be integrated with Py++. >> Yes: >> http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/pyplusplus/function_transformers/templates.py?revision=1467&view=markup >> >> The short version: if you applied a transformation, than everything >> should be done in it. >> >> The long version: you can modify the templates so it will release the >> GIL. You can do it without changing Py++ code. > > Thanks, that was useful! Btw I have to change the "whole template" and pay > attention to keep it aligned in the next releases of Py++ (that's ok for the > moment), More or less. You can change it value without touching Py++ code. For example: import pyplusplus import function_transformation as ft from ft import templates as ft_tmpl ft_tmpl.<class name>.<template> = NewTemplate You will only have to preserve the keywords and add your keywords/code. > what about adding $pre_call and $post_call params as in the > "default" Template? As above: let me think about it and I will back to you soon, okey? -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |