Hi all,
I'm having trouble wrapping a very simple member function with Boost.Python
using the
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS macro, getting a segmentation fault.
I run into the problem both with Boost 1.44.0 and 1.46.1, running on
Solaris 10/Sparc
using gcc 4.5.1 and Python 2.7.1.
What'
[ 2nd try due to user stupidity, please ignore if this is being delivered
twice ]
Hi all,
I'm having trouble wrapping a very simple member function with Boost.Python
using the
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS macro, getting a segmentation fault.
I run into the problem both with Boost 1.44
Hi,
this is basically a re-post of a problem I posted 5 weeks ago, on which
there's
been no echo whatsoever. Now, I'm unsure if this is because I posted on
April 1st,
nobody has ever seen this problem on his platform, nobody ever uses the
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS macro this way or I
Hi Ralf,
> You don't need the BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS macro if
> you support keyword arguments (which is usually best). It should be
> as simple as:
>
> .def("foo", &DefaultArgs::foo, (bp::arg("arg1")=100, bp::arg("arg2")=10))
>
>
> The FUNCTION_OVERLOADS macros are more or less a
Hi,
has py++ moved somewhere else?
This seems to be unreachable:
http://language-binding.net/pyplusplus/pyplusplus.html
Regards
Holger
Landesbank Baden-Wuerttemberg
Anstalt des oeffentlichen Rechts
Hauptsitze: Stuttgart, Karlsruhe, Mannheim, Mainz
HRA 12704
Amtsgericht Stuttgart
_
Hi,
I'm trying to wrap a C++-API that uses void* to pass around arbitrary,
application-specific stuff.
I am a bit unsure about how to work the void-pointers. A viable way seems
to wrap the original
API functions with thin wrappers that take a boost::python::object and hand
the "raw" PyObject*
in
Hi Jim,
> > I am a bit unsure about how to work the void-pointers. A viable way
seems
> > to wrap the original
> > API functions with thin wrappers that take a boost::python::object and
hand
> > the "raw" PyObject*
> > into the original function:
> >
>
> I don't see anything wrong with this approa
Hi,
> currently i am facing a problem regarding inheritance with boost::python
>
> Here is a simple code snippet:
>
>
> class Base
> {
> public:
> virtual void print() { std::cout << "hello" << std::endl; }
>
> };
>
> [...]
>
> And in python i want to have the following reslut:
>
> >>import
Hi,
> Ok lets say my BaseClass has a member function called init( vector4 ):
>
> class Base
> {
> public:
> void init( vector4 &vec ) { //doWhatEver }
> //a lot of other functions
> };
>
> Unfortunetaly i can not expose this init function directly to python so
> i am writing a BaseWrapp
Hi,
what's the recommended way to check if an object instance is an instance of
my extension class
in C++ code?
I'm currently doing a very ugly
#define isMyExtensionClass(pyobj) (strcmp(pyobj->ob_type->tp_name,
"MyExtensionClass") == 0)
on PyObj* pyobj.
I bet there is a better way but just ca
Hi,
I'm trying to instrument a wrapped class with custom __setattr__
mechanics:
.def("__setattr__", &MyExtensionClass::setattr)
How can I call the base class __setattr__ from within setattr and not run
into infinite recursion?
I.e. the analogon in C++ to
>> class Foo(object):
...
Stefan,
many thanks, that of course did the trick. I'm not seeing the wood for the
trees
any more, I fear.
> > what's the recommended way to check if an object instance is an
instance of
> > my extension class
> > in C++ code?
> >
> > I'm currently doing a very ugly
> >
> > #define isMyExtensionC
Hi,
> On 02/24/2012 05:44 AM, Holger Joukl wrote:
> > Just for the record, this is what I do now:
> >
> > inline
> > bool isMyExtensionClass(PyObject* &pyobj) {
> > bp::extract extractor(pyobj);
> > return extractor.check();
> > }
>
>
> > bp::object itself has reference (smart pointer) semantics, so there is
> > no need to pass objects by reference.
> > I see. Just out of curiosity:
> > If I pass by reference I do save a copy constructor call, don't I?
>
> In principle, yes. I'm not sure how much of this the compiler would be
>
> > To actually write to my instance dict I currently do
> >
> > PyObject* __dict__ = PyObject_GetAttrString(m_self,
const_cast
> > ("__dict__"));
> > PyDict_SetItemString(__dict__, name, value.ptr());
> >
> > inside MyExtensionClass::setattr (where m_self is PyObj*)
> >
> > Is there a be
Hi,
> The docs regarding the mutable copying problem are very misleading.
> Following Python [1] and Boost [2] scripts do not produce the same
results:
>
>
> [1]
> b = a = []
> c = list(a)
> a.append("s1")
> print a.count("s1"), b.count("s1"), c.count("s1") #prints 1 1 0
>
> [2]
> list a, b, c;
>
Hi,
"Cplusplus-sig"
schrieb am 02.09.2012 17:00:38:
> I have to make a python function as callback of a c++ function.How
> to do?Where can I find some examples?? I want to use boost.python.
> I want my code look something like this: In C++ :
> typedef void (*MyCallback_t) (CallbackInfo);
> c
Hi,
I'm wrapping a C++ library that's actually just a thin wrapper around a C
lib.
Through a dispatch() method of a Dispatcher class there's an invocation of
callbacks which get implemented on the Python side, by subclassing callback
classes exposed through Boost.Python.
Now, for performing the
Hi Giuseppe,
thanks for answering and sorry for the delayed response. Easter
holidays :-)
Giuseppe Corbelli wrote on 28.03.2013
09:37:39:
> On 26/03/2013 18:51, Holger Joukl wrote:
> >
> > Hi,
> >
> > I'm wrapping a C++ library that's actually j
Hi,
Giuseppe Corbelli wrote on 08.04.2013
11:29:10:
> On 03/04/2013 10:08, Holger Joukl wrote:
> > Hi Giuseppe,
> >
> > thanks for answering and sorry for the delayed response. Easter
> > holidays :-)
>
> To punish you here's another late reply.
;-)
>
Hi,
"Cplusplus-sig"
wrote on 09.04.2013 03:04:33:
> From: "Niall Douglas"
> On 8 Apr 2013 at 14:11, Holger Joukl wrote:
>
> > > I have found a couple of references.
> > > http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html (see
static-l
Hi,
Giuseppe Corbelli wrote on 09.04.2013
09:09:14:
> On 08/04/2013 14:11, Holger Joukl wrote:
> >> I have found a couple of references.
> >> http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html (see
static-libgcc)
> >> http://gcc.gnu.org/wiki/Visibility
> >
Hi,
> From: "Niall Douglas"
> On 10 Apr 2013 at 13:48, Holger Joukl wrote:
>
> > > If you don't have C++11 in your C++, Boost provides an okay partial
> > > implementation of C++11 exception support.
I'm currently using gcc 4.6.1 which supports t
Before trying out Niall's wealth of suggestions, just to fix up my own
erroneous example:
> From: Holger Joukl
> A bit of a simplified example version using Boost's partial C++11
exception
> support
> would then be s.th. like:
>
> 0 $ cat dispatch_main
Hi,
> From: "Niall Douglas"
> On 17 Apr 2013 at 17:13, Holger Joukl wrote:
>
> > // the global per-thread exception storage
> > boost::unordered_map exception_map;
>
> You can't assume pthread_t is of integral type. You can a thread_t
> (from C11)
Hi,
> I wrapped the boost ipc message queue into Python using Boost.Python.
> Everything goes fine except I found that
>
> 1. the try_receive / try_send will block python when the mq is empty /
full.
> 2. when I use the wrapped message queue in one Python thread, any
> other Python thread would be
Hi,
> For ElementWrap::get_float, try:
> float get_float() { return this->get_override("get_float")(); }
>
> Binding to Python of that function should then be:
> .def("get_float", pure_virtual(&Element::get_float))
>
> See also:
> http://www.boost.org/doc/libs/1_57_0/libs/python/doc/tutorial/doc/
> > > For ElementWrap::get_float, try:
> > > float get_float() { return this->get_override("get_float")(); }
> > >
> > > Binding to Python of that function should then be:
> > > .def("get_float", pure_virtual(&Element::get_float))
> > >
> > > See also:
> > > http://www.boost.org/doc/libs/1_57_0/lib
Hi,
not boost.python- but C/C++ syntax-related.
You never reach the Base class call in your wrapper class:
> struct SongWrapper : Song, bp::wrapper
> {
> void chorus()
> {
> if (bp::override chorus = this->get_override("chorus"))
> chorus();
> re
Hi Ernie,
> When I tries to use class exposed as ’wrapper’ as substitute for C
> ++ original class i am getting a segfault error (see example below).
> Is there is something wrong with a way i create a wrapper-class or
> it is not intended to work as substitute for a base class?
I haven't trie
Hi,
> [...]
> // expose to python
> BOOST_PYTHON_MODULE(grids)
> {
> class_ , boost::noncopyable >("A2")
>.def("ret",pure_virtual(&A2::ret));
>
> class_,bases>("B2");
> def("f1",f1);
> }
>
>
> I get the following result on execution :
>
> >import grids
> >>> a = grids.f1()
>
> T
Hi,
> Thank you for the reply.
> It compiles but same error on execution.
If I change the A2 exposure to
bp::class_, boost::noncopyable>("A2",
bp::no_init)
...
then f1() successfully returns a B2 object. But of course we then lose
the Python-callback abilities provided by the wrapper cl
> Von: Jason Addison
>
> How can results be returned in function arguments?
>
> I've include my example C++ extension and Python code below.
>
> I've tried, what I think, are some obvious approaches (Python objects,
> ctypes), though none have worked.
>
> It seems like this should be doable.
As a
Hi,
> Von: Jason Addison
> You can return results via function arguments from C to Python (see
> code below).
>
> Why is something similar impossible with Boost Python?
>
> my_module2.c
>
> /*
> clang -c -I/usr/include/python2.7 my_module2.c
> clang -dynamiclib -o my_module2.so -lpython2.7 my
Hi,
> I have a c++ class T that I succesfully expose via:
>
> class_ ...
>
> later on, I have
>
> struct S {
> const T* underlying;
> };
>
> class_("S").
> .def_readonly("underlying", &S::underlying)
> ;
>
> From python, when I call:
>
> s.underlying
>
> where s is a python instance of S, i
Hi,
"Cplusplus-sig"
schrieb am 09.09.2016 02:33:57:
> Hi,
>
> And here is yet another person who seems to encounter the same issue:
> http://stackoverflow.com/questions/9140572/c-boost-python-2-problems
>
> -Jon
Python expects an init function for extension modules named initNAME
where NAME is
36 matches
Mail list logo