On Aug 5, 2009, at 8:41 AM, Eloy Duran wrote:
Hi,
On Aug 5, 2009, at 5:31 PM, Clay Bridges wrote:
The google didn't yield much guidance on this. Before I started a
deep-dive on the MacRuby source, and/or the standard ruby way to
handle this sort of thing, I thought I would ask a couple of
questions:
1) Any easy advice?
Yes, use RubyCocoa
2) Is this different in MacRuby than in ruby proper?
RubyCocoa at least allows you to use BridgeSupport which would allow
you to map these. Afaik MacRuby doesn't fully support it yet.
3) Any pointers into the MacRuby source that might help me?
BridgeSupport needs to fully implemented.
FYI, BridgeSupport is mostly implemented in MacRuby, at least the part
that deals with C structures. The only part that we didn't implement
yet is C function pointers, the rest (roughly 90%) is done, and it is
faster / more stable than the RubyCocoa code (you will have to believe
me, since I wrote both :-)).
What Clay needs to do is describe his C structures in a .bridgesupport
file.
You can read the BridgeSupport(5) man-page for more information.
Unfortunately the gen_bridge_metadata(1) cannot generate C structures
metadata without a template, and this part is not yet documented. So
it may be faster to craft the .bridgesupport file by hand. There are
plenty of .bridgesupport files in /System/Library/Frameworks that can
be used as an example.
Once the file is created, it can loaded from MacRuby using:
load_bridge_support_file 'foo.bridgesupport'
Laurent
_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel