From: Eric Hodel Date: 2006-08-09T07:21:23+09:00 Subject: Re: FOUND was (Re: Init_xxx(with arg ??) in C for ruby ext ???) On Aug 8, 2006, at 12:13 PM, Eric Hodel wrote: > On Aug 8, 2006, at 10:25 AM, Une b�vue wrote: > >> Une b�vue wrote: >> >>> ew to C, i'm writing a ruby ext, i wonder if we could pass an arg to >>> Init_xxx(type * arg) ??? >>> >>> this is to have a constructor in ruby like that : >>> >>> trick=MyClass.new("my arg") >>> >>> and if not does exists a workaround ??? >> >> it is : >> >> rb_define_singleton_method(rb_cMyClass, "new", cd_new, 1); > > No. MyClass.new is inherited from Class. > > rb_define_method(rb_cMyClass, "new", cd_initialize, 1); Oops. rb_define_method(rb_cMyClass, "initialize", cd_initialize, 1); -- Eric Hodel - drbrain@segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com