>>>>> "A" == Andres Hidalgo <sol123 / msn.com> writes:

A> How can I enumerate the items in a hash passed to an extension (.c) from =
A> a script ?

 Well, you can use rb_iterate() (see README.EXT)

 VALUE rb_iterate(VALUE (*func1)(), void *arg1, VALUE (*func2)(), void *arg2)
 
 Where func1 can be rb_each(), and arg1 the hash

 For example (not tested) :

   static VALUE
   tt_i(arg1, arg2)
       VALUE arg1, arg2;
   {
       VALUE key, value;
   
       key = rb_ary_entry(arg1, 0);
       value = rb_ary_entry(arg1, 1);
       /* do what you want with key and value */
       return Qnil;
   }
   
   static VALUE
   tt(arg1)
       VALUE arg1;
   {
       VALUE arg2 = INT2FIX(12);
       return rb_iterate(rb_each, arg1, tt_i, arg2)
   }



Guy Decoux