Boost logo

Boost Users :

Subject: [Boost-users] [boost-users][python] Pointer argument failed conversion?
From: Germán Diago (germandiago_at_[hidden])
Date: 2009-04-30 11:45:24


Hello. After much googling I didn't find anything useful.
My problem is:

I have a virtual function like this

class MyClass {

      void monitor(Object * o);
}

I have wrapped another class, which inherits from Object:

class Character : public Object {...};

which is also exposed to python.

I register my virtual function as the documentation says I have to do:

class_<MyClass, boost::noncopyable>("MyClass").
 def("monitor", &MyClass::monitor);

When I try to call it from python, I get the following error:

a = MyClass()
b = Character(....)
a.monitor(b)

 MyClass.monitor(MyClass, Character)
did not match C++ signature:
    monitorizar(MyClass {lvalue}, Object *)

Shouldn't my Character be automatically converted to Object * and then
to make a successful call to the function?
Should I do anything special to use pointers as parameters of my
functions? I don't know why it tries to pass a "Character".
What I want is to get it converted to Object *. Thanks in advance.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net