Objective-C Ruby Extension

Hi Everyone,

While toying around, I decided to start work on a trivial Objective-C
Ruby Extension / eventual tutorial “because I can.” Which is the best
reasoning for anything, ever. It’s a tad incomplete, but I’d love to
get some feedback so far, if anyone has any:

http://github.com/aitrus/objc_ruby-ext

Note: This isn’t Mac specific, ala RubyCocoa / MacRuby / yadda.

Issues Getting it to Work:

  • mkmf hardcodes the ‘.c’ extension as the only file extension that
    you can compile with the C compiler. You can work around this a
    variety of ways, but they’re all hackish.
  • Data_Get_Struct does not work, as it seems to be checking to make
    sure you’re giving it a struct datatype. The only real work around
    for this was to pull out its DATA_PTR line, bypassing its primitive
    type checking.
    – Rather than: Data_Get_Struct(self, Fraction, frac);
    – I write: frac = (Fraction*)DATA_PTR(self);

Everything seems to play just peachy with Ruby.

Scott