From: Dirkjan Bussink Date: 2009-10-13T02:25:27+09:00 Subject: Re: Any "easy" example of using T_HASH in a C extension? On 12 Oct 2009, at 18:24, Iņaki Baz Castillo wrote: > Hi, I've found some tutorials explaining how to create and manipulat > a Ruby > array from a C extension using T_ARRAY and its realted functions. > However I find nothing about T_HASH, and trying to extract the > functions from > Ruby "hash.c" code is... not very cool. I'd advise against using T_ARRAY, RARRAY_PTR etc, writing stuff with the following methods makes life a lot easier for other Ruby implementations that also support MRI C extensions: rb_ary_new(void); rb_ary_push(VALUE array, VALUE element); rb_ary_entry(VALUE array, long i); rb_ary_store(VALUE array, long i, VALUE element); -- Regards, Dirkjan Bussink