Hello, I've installed the latest nightly build from 12/7, and tried running the sample code from the last blog post regarding calling [NSArray enumerateObjectsUsingBlock:] from with macirb. I successfully get a segfault every time I run the sample: framework 'Foundation' a = [1, 2, 3, 4, 5] a.enumerateObjectsUsingBlock(Proc.new { |obj, index, stop| p obj stop.assign(true) if index == 2 }) Has anything changed since that sample code was posted? Thanks, Saul
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 Laurent On Dec 7, 2010, at 3:55 PM, Saul Mora wrote:
Hello,
I've installed the latest nightly build from 12/7, and tried running the sample code from the last blog post regarding calling [NSArray enumerateObjectsUsingBlock:] from with macirb. I successfully get a segfault every time I run the sample:
framework 'Foundation' a = [1, 2, 3, 4, 5] a.enumerateObjectsUsingBlock(Proc.new { |obj, index, stop| p obj stop.assign(true) if index == 2 })
Has anything changed since that sample code was posted? Thanks, Saul _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
That fixed it. Thanks! Laurent Sansonetti 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
Laurent
On Dec 7, 2010, at 3:55 PM, Saul Mora wrote:
Hello,
I've installed the latest nightly build from 12/7, and tried running the sample code from the last blog post regarding calling [NSArray enumerateObjectsUsingBlock:] from with macirb. I successfully get a segfault every time I run the sample:
framework 'Foundation' a = [1, 2, 3, 4, 5] a.enumerateObjectsUsingBlock(Proc.new { |obj, index, stop| p obj stop.assign(true) if index == 2 })
Has anything changed since that sample code was posted? Thanks, Saul _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org <mailto:MacRuby-devel@lists.macosforge.org> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
On Tue, 7 Dec 2010 16:13:13 -0800 Laurent Sansonetti <lsansonetti@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... Perry
Laurent
On Dec 7, 2010, at 3:55 PM, Saul Mora wrote:
Hello,
I've installed the latest nightly build from 12/7, and tried running the sample code from the last blog post regarding calling [NSArray enumerateObjectsUsingBlock:] from with macirb. I successfully get a segfault every time I run the sample:
framework 'Foundation' a = [1, 2, 3, 4, 5] a.enumerateObjectsUsingBlock(Proc.new { |obj, index, stop| p obj stop.assign(true) if index == 2 })
Has anything changed since that sample code was posted? Thanks, Saul _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
-- Perry E. Metzger perry@piermont.com
On Dec 7, 2010, at 6:14 PM, Perry E. Metzger wrote:
On Tue, 7 Dec 2010 16:13:13 -0800 Laurent Sansonetti <lsansonetti@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
On Tue, 7 Dec 2010 18:24:16 -0800 Laurent Sansonetti <lsansonetti@apple.com> wrote:
On Dec 7, 2010, at 6:14 PM, Perry E. Metzger wrote:
On Tue, 7 Dec 2010 16:13:13 -0800 Laurent Sansonetti <lsansonetti@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.
And there is no way to check for the presence of a signature before attempting this? Perry -- Perry E. Metzger perry@piermont.com
On 2010-12-07, at 22:13 , Laurent Sansonetti 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
Is this part of trunk, nightlies, and a future 0.8 by default?
participants (4)
-
Caio Chassot
-
Laurent Sansonetti
-
Perry E. Metzger
-
Saul Mora