[MacRuby-devel] Calling Block-based C APIs with Ruby Procs

Laurent Sansonetti lsansonetti at apple.com
Tue Dec 7 18:24:16 PST 2010


On Dec 7, 2010, at 6:14 PM, Perry E. Metzger wrote:

> On Tue, 7 Dec 2010 16:13:13 -0800 Laurent Sansonetti
> <lsansonetti at apple.com> wrote:
>> Hi Saul,
>> 
>> Did you install the BridgeSupport preview 1 release? Without it, C
>> blocks won't work in MacRuby.
>> 
>> http://www.macruby.org/blog/2010/10/08/bridgesupport-preview.html
> 
> Even without the BridgeSupport stuff, it should not segfault, it
> should error out, preferably with a human comprehensible error. It is
> bad behavior for an HLL interpreter to register its displeasure by
> crashing…

Agreed, however we can't avoid crashing here, as this happens in the C/Objective-C side of the bridge. MacRuby will let you pass most objects to native APIs, but without proper BridgeSupport signatures, these objects might not be properly converted.

In this case, NSArray tries to call something that isn't a pointer to a block function. And the Objective-C runtime doesn't annotate properly block arguments, so BridgeSupport signatures are needed by MacRuby.

Laurent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20101207/1ef3319b/attachment.html>


More information about the MacRuby-devel mailing list