[MacRuby-devel] How to use custom C struct's?

Clay Bridges diffengr at gmail.com
Wed Aug 5 08:31:54 PDT 2009


Hi all,

I'm writing an iPhone app. I made the audacious step of trying to test
my ObjC model classes using MacRuby. I create and load a dynlib
("bundle") of these classes. So far, so good.

However, I have a C struct that I use all over the place:

struct MapPoint {
  int row;
  int col;
};
typedef struct MapPoint MapPoint;

Obviously, when I have a method that returns that type, MacRuby
doesn't like it. That is,

# ruby
my_objc_object.mapPoint

gives this error:

RuntimeError: unrecognized octype `{MapPoint=ii}'

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?

2) Is this different in MacRuby than in ruby proper?

3) Any pointers into the MacRuby source that might help me?

Thanks,

Clay Bridges


More information about the MacRuby-devel mailing list