From: "Darryl L. Pierce" Date: 2012-04-19T01:53:04+09:00 Subject: Re: C extension: How to get a block passed to a method? On Wed, Apr 18, 2012 at 12:34 PM, Iņaki Baz Castillo wrote: If I understand your question correctly, you're asking how to invoke a block that's passed into a method written as a native extension. Is that correct? In a Ruby extension written in C, you would use something like this: // if a block was passed to this method then invoke it if(rb_block_given_p()) { rb_yield(/* args */); } rb_block_given_p() returns true if a code block was passed into the method being processed. And rb_yield invokes that block with the provided arguments (you can pass 0 or more args to the rb_yield). HTH. -- Darryl L. Pierce Visit the Infobahn Offramp: "Bury me next to my wife. Nothing too fancy..." - Ulysses S. Grant