From: "Esteban Manchado Velázquez" Date: 2006-01-31T05:43:37+09:00 Subject: Re: inheritance from C object with different parameter count --3siQDZowHQqNOShm Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 30, 2006 at 06:12:13PM +0900, Geert Fannes wrote: > Hello, >=20 > I'm trying to create a derived class (ruby class) from a C-implemented > class. Everything works fine, until I tried to add a parameter to the > derived class. When I derive from a pure ruby base class, everything > works as should be, extra parameter or not. Does someone know what is > going on or what I am doing wrong? Hmmm... weird. If you comment the "super()" call in Derived#initialize,= it dies with the exact same error. In fact, you don't even get the "init deriv= ed" message. After investigating a little, I found out that changing the definition = of new to: rb_define_singleton_method(cBase, "new", f_new0, -1); makes it work. I don't know if that's entirely correct (I'm not very famili= ar with C extensions), but it works :-) I guess the problem is that, as you do= n't redefine the "new" method in the class Derived, you get the Base one, so it chokes. I don't know if the usual thing here is always defining "new" metho= ds with any parameter count... HTH, --=20 Esteban Manchado Vel=E1zquez - http://www.foton.es EuropeSwPatentFree - http://EuropeSwPatentFree.hispalinux.es --3siQDZowHQqNOShm Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQFD3gMkhYgK5b1UDsERAvC0AJ9V/NvJSedzTHYPpN2/1NLzJl0IMQCeIcBZ 0C3ygKmGThVW5qCaHqOqgDc= =4+ug -----END PGP SIGNATURE----- --3siQDZowHQqNOShm--