[C++-sig] assign a pointer to global object

Gennadiy Rozental rogeeff at gmail.com
Wed Jul 23 16:52:58 CEST 2008


Hi,

I am sure I missing something trivial, but I can't make work most simple example
like this:

c++ side

struct AAA {

};

AAA s_global;

void 
assign_aaa( bp::object& o )
{
    o.attr("aaa") = &s_global;
}

...

export_func
{
 ...
    class_<AAA,AAA*,boost::noncopyable>( "AAA", no_init );

    def( "assign_aaa", &assign_aaa );
}

python side:

assign_aaa( object() )

Error:

TypeError: No to_python (by-value) converter found for C++ type: struct AAA

Please advise,

Gennadiy







More information about the Cplusplus-sig mailing list