[C++-sig] Re: Pyste-generated extentsion Aborts Python

Nicodemus nicodemus at globalite.com.br
Sat Jul 5 03:40:48 CEST 2003


Hi Jim,

Jim Wilson wrote:

>     >>>from fltk import Fl,Fl_Window
>     Traceback (most recent call last):
>         File "<stdin>", line 1, in ?
>         RuntimeError: Boost.Python - All overloads must be exported 
> before \
>         calling 'class_<...>("Fl").staticmethod("scheme")'
>
> I hope this gives you a clue, because I'm clueless.


Hah! You just found a bug, congratulations! ;)
I didn't know myself, but you have to use "staticmethod" only after all 
the overloads of a static method were exported.

Consider:

struct C
{
    static int foo(int x) { return x; }
    static int foo(int x, int y) { return y; }
};


Pyste naively generates:

class_< C >("C", init<  >())
        .def(init< const C& >())
        .def("foo", (int (*)(int))&C::foo)
        .staticmethod("foo")
        .def("foo", (int (*)(int, int))&C::foo)
        .staticmethod("foo")
    ;

And running that from Python gives the same error. 8)

It should generate:

class_< C >("C", init<  >())
        .def(init< const C& >())
        .def("foo", (int (*)(int))&C::foo)      
        .def("foo", (int (*)(int, int))&C::foo)
        .staticmethod("foo")
    ;


I will fix ASAP (tomorrow I don't think it is possible, because I am 
about to leave home), but tomorrow it should be fixed. 8)

Why the other functions didn't compile is still a mistery. Could you 
post the signature of one of them, along with the generated code for 
that function?
Also, thanks a lot for all your efforts in finding this problems!

Regards,
Nicodemus.





More information about the Cplusplus-sig mailing list