At Tue, 19 Dec 2000 10:38:53 +0900,
David Alan Black wrote:

> I'm trying to get access to rb_ary_replace, which I see defined and
> used in array.c but can't use in my own C code.  I get:
> 
>   ruby: error in loading shared libraries:
>   /usr/local/lib/ruby/1.6/i586-linux/Test.so: undefined symbol:
>   rb_ary_replace

that's because it's a static function defined in array.c, about line
529 if you have cvs version.

your C compiler should warn you when you compile your module.

> when I try to use it.
> 
> Is there (a) a reason for this method not being available, or (b) a
> way to use it from C that I'm not thinking of?  (That would include
> any way that works :-)

I can't answer a) for matz, but not all method is exposed with one to
one C API.

for b) try rb_funcall*() or rb_apply()

  VALUE ary, rpl, rng;

  rng = rb_range_new(INT2FIX(2), INT2FIX(4), Qtrue);
  rb_funcall(ary1, rb_intern("replace"), 2, rng, rpl);

It's on `Ruby Programming' p193 "API: Calling Methods"

or README.EXT at 2.2.3 "Invoke Ruby method from C"

hope this helps,
--
           yashi