From: Joel VanderWerf Date: 2002-09-10T04:02:08+09:00 Subject: Re: HOWTO create Ruby bindings for a library Lyle Johnson wrote: > Giuseppe Bilotta wrote: > >> I have this library which I would like to use with Ruby. How do I do it? > > > Tom has already mentioned Ruby/DL in a separate response. Two other > choices you might want to consider are Joel VanderWerf's CGenerator > module (http://redshift.sourceforge.net/cgen) and SWIG > (http://www.swig.org). If it's straight C code in the library I think > Ruby/DL might be a good choice and CGenerator possibly better; I haven't > used either of them. If you're dealing with C++ code, I think SWIG might > be the right choice. If you have the source, C or C++, I would try SWIG first. I haven't used it, but from what I understand, you won't have to modify the library much, just add some auxilliary interface description files. CGenerator doesn't really help much with an existing library, unless you want to do a lot of cutting and pasting into your ruby program. If you are developing a C library from scratch, or writing a ruby program that needs to generate and execute C code on the fly (e.g., for math expressions), then CGenerator is worth a look.