From: Joel VanderWerf Date: 2004-11-16T04:10:50+09:00 Subject: Re: ruby extension best practices leon breedt wrote: > hi, > > i am about to create an extension for a third party API (API is pretty > consistent), was wondering what the best practices are. > > are there tools for generating the glue for methods on classes i > create to wrap the various abstractions? > > is there something like Pyrex for Ruby? (google didn't really come up > with anything conclusive). > > what is the most "modern" way of creating extensions without making > too much work for myself such that it is difficult to maintain? > > when is it a good idea to use Ruby/DL and when not? Check out SWIG. It can do most of the work for you, generating wrappers for the 3rd party API. Another possibility, is cgen (on RAA) which I wrote to provide a ruby interface to the ruby C API. It was intended for code generation rather than wrapping, so it might be a better choice if you are generating an extension from scratch. I have used it with an existing library, though.