[C++-sig] Re: Problem with different return types.

Aashish Chaudhary aashish at iastate.edu
Sat Feb 7 19:47:04 CET 2004


I have compiled boost.python on Linux after unsuccessfull attempt to compile it
on windows (I found VC7.0 can not compile it as shown the status of boost.python
compilation for VC7.0 on boost.python web).

Well then I tried to build some basic examples .. and it just worked fine ... I
got into trouble when I tried to compile 
a example from register_ptr_to_python.hpp

struct A
    virtual int f() { return 0; }

shared_ptr<A> New() { return shared_ptr<A>( new A() ); }

int Ok( const shared_ptr<A>& a ) { return a->f(); }

int Fail( shared_ptr<A>& a ) { return a->f(); }

struct A_Wrapper: A
    A_Wrapper(PyObject* self_): self(self_) {}
    int f() { return call_method<int>(self, "f"); }    
    int default_f() { return A::f(); }    
    PyObject* self;

    class_<A, A_Wrapper>("A")
        .def("f", &A::f, &A_Wrapper::default_f)
    def("New", &New);
    def("Ok", &Call);
    def("Fail", &Fail);
    register_ptr_to_python< shared_ptr<A> >();

and when in the python file I did this:

from register_ptr import *

it throws me the error :

Traceback (most recent call last):
  File "usr/src/bp_register_test.py", line 2, in ?
    from bp_register import *
ImportError: dynamic module does not define init function (initbp_register)

I am wondering why it would happened ???

Thanks for any help. 


Aashish Chaudhary

Research Assistant
Iowa State University                   E-Mail: aashish at iastate.edu 
Ames, Iowa                              Telephone: +1 515-441-1178

More information about the Cplusplus-sig mailing list