[C++-sig] C++ static function as __init__
Piotr Jaroszyński
p.jaroszynski at gmail.com
Thu Jun 14 02:20:13 CEST 2007
Hello,
I want to do possibly strange thing:
struct Foo {
Foo() {}
static void init_me(PyObject * self) {
??? (I want to initialize self with a new Foo object using its constructor)
}
};
(...)
bp::class_<Foo> foo("Foo", bp::no_init);
foo.def("__init__", &Foo::init_me);
The above "works" as in the signature matches, but I have no idea how to
initialize the object properly given the PyObject self pointer. I was trying
to dig in the code how is bp::init really working but I failed miserably :/
Any clues? ;]
--
Best Regards,
Piotr Jaroszyński
More information about the Cplusplus-sig
mailing list