On Mon, Sep 01, 2008 at 10:16:45AM +0900, Nobuyoshi Nakada wrote:
> void Init_foo()
> {
>     VALUE cFoo = rb_define_class("Foo", rb_cObject);
>     rb_define_method(cFoo, "foo", foo, -1);

This creates a method, not a block.  The original example used
rb_iterate to create a block:

> > rb_iterate(dm, ID2SYM(rb_intern("foo")), foo, val);

I think using define_method() in the original example confused the
issue.  I don't want to create a method at all.  Perhaps a better
question is how to do this in C:

irb(main):001:0> p = proc { |&b| p b }
=> #<Proc:0x4029b004@(irb):1>
irb(main):002:0> p.call { 1 + 1 }
#<Proc:0x402981d8@(irb):2>
=> #<Proc:0x402981d8@(irb):2>

Paul