C Extension rb_block_call Weirdness


#1

I’ve already posted a description of my problem at Stackoverflow, but
realized it might be most appropriate to post here as well, so I will
summarize and then link.

I am having this problem consistently with 1.9.1-p378 and with 1.9.2rc1.

The short of it is that when I call rb_block_call, the called block
function receives the yield value and data2 appropriately, but argc is
always set at 1 (no matter what I pass) while argv[ 0 ] and argv[ 2 ] ==
yield value, and argv[ 1 ] == Qfalse.

More detail and my code can be found here:

Any insight is appreciated, as I am at a point where it is difficult to
move on until this is worked out.

Asher


#2

Resolved:

The documentation should read: Calls a method on the recv, with the
method name specified by the symbol mid, with argc arguments in argv,
supplying func as the block. When func is called as the block, it will
receive the value from yield as the first argument, and data2 as the
second argument.

In other words, argc and argv are for the Ruby iteration method and not
for the “func” callback function, as the documentation suggests.