"Paul Brannan" <pbranna / nospam.clemson.edu> writes: > I've recently had the need to find the length of a Ruby array from within > a C program. It seems that rb_ary_length would be perfect for this, but > the function is static, so I don't have access to it. What I'd like to > avoid is popping all the elements off the array and pushing them back on > just to count the number of elements, or something similar, since that's > obviously not efficient. What's the best way to do this? Perhaps you'll just have to access the data directly then... RARRAY(ary)->len But I prefer using an accessor function. Maybe the ruby code should make this a visible function and remove the static linkage. (Anyone have any comments on that?) -- Chris