From: Jimmy Thrasher Date: 2001-09-26T06:18:05+09:00 Subject: [ruby-talk:21684] Re: Extension Question: Block Parameters I'm pretty sure the following is correct: Specify the parameter in your C function, e.g. VALUE myrb_foo(int argc, VALUE* argv, VALUE self) { VALUE aBlock; rb_scan_args(argc, argv, "0&", &aBlock); return rb_funcall(self, rb_intern("bar"), 1, aBlock); } of course, the following might work: VALUE myrb_foo(int argc, VALUE* argv, VALUE self) { return rb_funcall2(self, rb_intern("bar"), argc, argv); } Of course, you call rb_define_method in the right places.. Jimmy Jason Voegele wrote: > > When creating a Ruby extension in C, what is the C equivalent of the > following construct? > > def foo(&aBlock) > bar(&aBlock) > end > > # examples: > foo > foo {|obj| do_something} > > If a block is provided, the foo method should pass along the block to > the bar method. I couldn't find any documentation on this. > > Thanks, > Jason Voegele