Ruby and SWIG

Kirk McDonald kirklin.mcdonald at gmail.com
Mon Sep 17 17:07:13 PDT 2007


Ruby-Man wrote:
> I would like to use SWIG to code some Ruby extensions however having
> never done this myself with D I would like some pointers or samples I
> might use to make this easier for me.
> 
> Can anyone give me some help with this ?
> 
> Thanks.

You have a couple of obstacles to overcome:

First, I do not believe that SWIG knows how to work with D. You will 
probably not be able to use SWIG at all with D.

Second, there are no complete Ruby/C API bindings to D. There are some 
incomplete ones on Google code:
     http://code.google.com/p/rubyd/
But these are missing various bits and pieces, such as preprocessor 
macros. Getting these bindings up to par is a sizable project in and of 
itself, and necessary before any Ruby/D development can take place.

Once you have those bindings, you'll probably have to use that C API 
manually. To simplify matters, you'll probably end up writing something 
like SWIG for D, or something like Pyd for Ruby (call it Rudy). Having 
written Pyd, I've offered a couple of times to at least start Rudy if 
only someone else would write the Ruby/D bindings. I do not know Ruby 
that well, and do not feel that I am qualified to write the bindings. 
But having the bindings, I could figure out how to use them, and bring 
D's templates to bear to simplify using them. Or someone else could, if 
they feel like it.

-- 
Kirk McDonald
http://kirkmcdonald.blogspot.com
Pyd: Connecting D and Python
http://pyd.dsource.org



More information about the Digitalmars-d mailing list