2007/8/15, Tim Hunter <TimHunter / nc.rr.com>:
> Gerardo Santana G?mez Garrido wrote:
> > In a C extension I have a function that calls to rb_yield to invoke
> > the block that the final user will supply.
> >
> > I want to call that function from within that same C extension. The
> > problem is how to create  and pass a block to this function, in C.
> >
> > Thanks in advance for any advice.
> >
> >
> I think rb_iterate() will do what you want.
>
> VALUE rb_iterate( VALUE (*method)(), VALUE args, VALUE (*block)(), VALUE
> arg2 )
> Invokes method with argument args and block block. A yield from
> that method will invoke block with the argument given to yield and
> a second argument arg2.

Thank you Tim, that function is what I was looking for.

But I have another problem. The method I want to call receives the
following parameters:

int argc, VALUE *argv, VALUE klass

I can't pass those parameters as args.

Any idea?
-- 
Gerardo Santana