D
Daniel Berger
Hi all,
What is the proper way to alias "new" in a C extension using the new
allocation framework? In other words, I want Foo.open to be an alias
to Foo.new.
// A basic Foo class
static VALUE foo_allocate(VALUE klass){ ... }
VALUE foo_init(int argc, VALUE *argv, VALUE self){ ... }
void Init_foo(){
...
rb_define_alloc_func(cFoo,foo_allocate);
rb_define_method(cFoo,"initialize",foo_init,-1);
}
Since there is no "new" method, how do create a class method that's an
alias to allocate() + initialize()? Or do I have to write it out
manually myself?
Regards,
Dan
What is the proper way to alias "new" in a C extension using the new
allocation framework? In other words, I want Foo.open to be an alias
to Foo.new.
// A basic Foo class
static VALUE foo_allocate(VALUE klass){ ... }
VALUE foo_init(int argc, VALUE *argv, VALUE self){ ... }
void Init_foo(){
...
rb_define_alloc_func(cFoo,foo_allocate);
rb_define_method(cFoo,"initialize",foo_init,-1);
}
Since there is no "new" method, how do create a class method that's an
alias to allocate() + initialize()? Or do I have to write it out
manually myself?
Regards,
Dan