>>>>> "D" == David Landrith <dlandrith / mac.com> writes:

D> can simply duplicate these in my extension struct.  Unless all 
D> inheritance is handled by rb_define_class, something like this would 
D> seem to be needed in order to preserve the existing functionality that 
D> I want to inherit from Array.

 Well, I've not understood what you want to do, but try this

pigeon% cat aa.c
#include "ruby.h"

static VALUE
aa_aa(obj)
    VALUE obj;
{
    int i, j;
    for (i = 0; i < RARRAY(obj)->len; i++) {
        j = NUM2INT(RARRAY(obj)->ptr[i]);
        RARRAY(obj)->ptr[i] = INT2NUM(j + 1);
    }
}

void Init_aa()
{
    VALUE aa_cAa;

    aa_cAa = rb_define_class("Aa", rb_cArray);
    rb_define_method(aa_cAa, "aa", aa_aa, 0);
}
pigeon% 

pigeon% ruby -raa -e 'a = Aa.new; a << 1; a << 2; a.aa; p a'
[2, 3]
pigeon% 


Guy Decoux