OK, thanks. At least I am a bit further. Maybe some effort should be invested in documenting the C extension process in clear detail, since it is always very confusing if you want to do things that are a bit more complicated. Are you aware of a good place where I can find detailed information?
Greetings,
Geert.

-----Original Message-----
From: Esteban Manchado Vel?zquez [mailto:zoso / foton.es] 
Sent: Monday, January 30, 2006 9:44 PM
To: ruby-talk ML
Subject: Re: inheritance from C object with different parameter count

On Mon, Jan 30, 2006 at 06:12:13PM +0900, Geert Fannes wrote:
> Hello,
> 
> 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 derived"
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 familiar
with C extensions), but it works :-) I guess the problem is that, as you don'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" methods
with any parameter count...

    HTH,

-- 
Esteban Manchado Vel?zquez <zoso / foton.es> - http://www.foton.es
EuropeSwPatentFree - http://EuropeSwPatentFree.hispalinux.es