www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Ruby and SWIG

reply Ruby-Man <raychorn hotmail.com> writes:
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.
Sep 17 2007
parent reply Kirk McDonald <kirklin.mcdonald gmail.com> writes:
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
Sep 17 2007
parent Ray C Horn <raychorn hotmail.com> writes:
I will write the Ruby code for Rudy if you write the D code for Rudy !

Kirk McDonald Wrote:

 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

Sep 18 2007