On Thu, Dec 27, 2007 at 11:46:24PM +0900, Jason Roelofs wrote:
> Wrap this:
> 
> class A {
>   public:
>     A();
>     A(int, int);
> 
>     void doSomething();
>     int getSomethingBack();
> };
> 
> Like this:
> 
> class_<A>("A")
>    .def(initialize<int, int>())
>    .def("do_something", &A::doSomething)
>    .def("get_something_back", &A::getSomethingBack);

Rice (http://rubyforge.org/projects/rice) lets you do it like this:

  extern "C"
  void Init_myextension()
  {
    define_class<A>("A")
      .define_constructor<Constructor<A>())
      .define_method("do_something, &A::doSomething)
      .define_method("get_something_back", &A::getSomethingBack);
  }

I avoided the boost::python syntax so the library would feel more
familiar to people who use the C Ruby API.

I don't yet have support for non-default constructors working, but I'd
welcome the help. :)

Paul