From: Masaki Fukushima Date: 2000-12-30T02:05:50+09:00 Subject: [ruby-talk:8272] Re: Overriding initialize() methods for SWIG-generated wrapper code? At Fri, 29 Dec 2000 05:10:02 +0900, Lyle Johnson wrote: > class MyDerivedClass < MyExtensionModule::MyBaseClass > def initialize(one, two) > # Base class constructor requires four arguments > super(one, two, "Foo", "Bar") > end > end > > If I try to create an instance of MyDerivedClass: > > thing = MyDerivedClass.new("first argument", "second argument") > > I get an error indicating that "new" wants four input arguments instead of > the two I've provided. It looks like the wrapper code for "MyBaseClass" > intercepts the call to "new" and never even tries to invoke "initialize". It's just a flaw in the implementation of SWIG/Ruby. Invoking "initialize" from extension class was not so common technique when I wrote that part of SWIG. So just adding rb_obj_call_init() may clear up the problem. If you've already made some fix, I want to apply the patch. Or I'll fix. Masaki Fukushima