[MacRuby-devel] handling void pointers in callbacks

Michael Johnston lastobelus at mac.com
Sat Jan 9 00:01:33 PST 2010

I'm working through the PragProg Core Data book, and have encountered an issue passing contextInfo to NSOpenPanel.beginSheetForDirectory

This issue was discussed on the list previously by Dr. Nic: http://www.mail-archive.com/macruby-devel@lists.macosforge.org/msg00330.html

The problem is that there doesn't seem to be a way to cast an object pointer to a void pointer in Macruby, but when openPanel calls the callback assigned in didEndSelector it does cast the pointer passed in contextInfo to a void pointer, leading to a type error when the callback is called:

2010-01-08 23:44:49.580 GrokkingRecipesRuby[34059:10b] expected instance of Pointer of type `v', got `@'

I tried assigning my object to a Pointer.new('^v') and Pointer.new(:uchar) but this also caused type errors.

is there any workaround for this? 


Michael Johnston
lastobelus at mac.com

More information about the MacRuby-devel mailing list