# Bindings/wrapper: how to?

**URL:** <https://rubytalk.org/t/bindings-wrapper-how-to/41066>\
**Category:** ruby-talk\
**Created:** [1 October 2007 03:28 UTC](https://rubytalk.org/t/bindings-wrapper-how-to/41066 "2007-10-01T03:28:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Britt](https://avatars.discourse-cdn.com/v4/letter/j/22d042/32.png) [@James\_Britt](https://rubytalk.org/u/James_Britt)\
**Post date:** [1 October 2007 03:28 UTC](https://rubytalk.org/t/bindings-wrapper-how-to/41066/1 "2007-10-01T03:28:13Z")

</div>

Any tips or resources for creating a wrapper or bindings in Ruby to an existing C library?  
How does one go about this correctly?

---

<div class="post-metadata">

**Author:** ![Joel\_VanderWerf1](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@Joel\_VanderWerf1](https://rubytalk.org/u/Joel_VanderWerf1)\
**Post date:** [1 October 2007 03:37 UTC](https://rubytalk.org/t/bindings-wrapper-how-to/41066/2 "2007-10-01T03:37:10Z")

</div>

John Joyce wrote:

> Any tips or resources for creating a wrapper or bindings in Ruby to an existing C library?  
> How does one go about this correctly?

[http://www.swig.org/](http://www.swig.org/) is pretty widely used.

> **···**
>
> --  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

---

<div class="post-metadata">

**Author:** ![Alex\_Gutteridge](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@Alex\_Gutteridge](https://rubytalk.org/u/Alex_Gutteridge)\
**Post date:** [1 October 2007 04:13 UTC](https://rubytalk.org/t/bindings-wrapper-how-to/41066/3 "2007-10-01T04:13:51Z")

</div>

The pickaxe has an excellent chapter on how to proceed with a simple library:

[http://www.rubycentral.com/pickaxe/ext\_ruby.html](http://www.rubycentral.com/pickaxe/ext_ruby.html)

Alex Gutteridge

Bioinformatics Center  
Kyoto University

> **···**
>
> On 1 Oct 2007, at 12:28, John Joyce wrote:
> 
> > Any tips or resources for creating a wrapper or bindings in Ruby to an existing C library?  
> > How does one go about this correctly?

---

<div class="post-metadata">

**Author:** ![James\_Britt](https://avatars.discourse-cdn.com/v4/letter/j/22d042/32.png) [@James\_Britt](https://rubytalk.org/u/James_Britt)\
**Post date:** [1 October 2007 04:35 UTC](https://rubytalk.org/t/bindings-wrapper-how-to/41066/4 "2007-10-01T04:35:06Z")

</div>

SWIG may be the way to go.  
I'm learning Allegro at the moment and thinking how much less work it would be to type it in Ruby...  
I've seen some people have done some Perl SWIGging with Allegro.  
But I've got a bit too much going on to learn SWIG at the moment. I just want to find out what I may be facing.

---

<div class="post-metadata">

**Author:** ![Tim\_Hunter4](https://avatars.discourse-cdn.com/v4/letter/t/ea5d25/32.png) [@Tim\_Hunter4](https://rubytalk.org/u/Tim_Hunter4)\
**Post date:** [1 October 2007 11:01 UTC](https://rubytalk.org/t/bindings-wrapper-how-to/41066/5 "2007-10-01T11:01:33Z")

</div>

John Joyce wrote:

> SWIG may be the way to go.  
> I'm learning Allegro at the moment and thinking how much less work it would be to type it in Ruby...  
> I've seen some people have done some Perl SWIGging with Allegro.  
> But I've got a bit too much going on to learn SWIG at the moment. I just want to find out what I may be facing.

The Pickaxe has an excellent chapter on extending Ruby, or you can read the README.EXT that comes with the Ruby source files.

> **···**
>
> --  
> RMagick OS X Installer [[http://rubyforge.org/projects/rmagick/\](http://rubyforge.org/projects/rmagick/%5C)]  
> RMagick Hints & Tips [[http://rubyforge.org/forum/forum.php?forum\_id=1618\](http://rubyforge.org/forum/forum.php?forum_id=1618%5C)]  
> RMagick Installation FAQ [[http://rmagick.rubyforge.org/install-faq.html\](http://rmagick.rubyforge.org/install-faq.html%5C)]
