From: ts Date: 2005-06-01T00:40:56+09:00 Subject: Re: Passing a block to rb_funcall >>>>> "D" == Daniel Berger writes: D> I've seen some mention of rb_iterate, but I wasn't sure how to apply it D> here. From plruby static VALUE pl_each(tmp) VALUE *tmp; { return rb_funcall2(tmp[0], (ID)tmp[1], (int)tmp[2], (VALUE *)tmp[3]); } /* ... */ if (rb_block_given_p()) { VALUE tmp[4]; tmp[0] = obj; tmp[1] = (VALUE)id; tmp[2] = (VALUE)argc; tmp[3] = (VALUE)argv; return rb_iterate((VALUE(*)(VALUE))pl_each, (VALUE)tmp, rb_yield, 0); } /* ... */ Guy Decoux