# Bindings/wrapper: how to?

**URL:** <https://www.ruby-forum.com/t/bindings-wrapper-how-to/115973>\
**Category:** Ruby\
**Created:** [October 1, 2007, 5:28am UTC](https://www.ruby-forum.com/t/bindings-wrapper-how-to/115973 "2007-10-01T05:28:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [October 1, 2007, 5:28am UTC](https://www.ruby-forum.com/t/bindings-wrapper-how-to/115973/1 "2007-10-01T05:28:50Z")

</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:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [October 1, 2007, 6:14am UTC](https://www.ruby-forum.com/t/bindings-wrapper-how-to/115973/2 "2007-10-01T06:14:24Z")

</div>

On 1 Oct 2007, at 12:28, John J. 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?

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 G.

Bioinformatics Center  
Kyoto University

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [October 1, 2007, 5:37am UTC](https://www.ruby-forum.com/t/bindings-wrapper-how-to/115973/3 "2007-10-01T05:37:36Z")

</div>

John J. 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.

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [October 1, 2007, 1:02pm UTC](https://www.ruby-forum.com/t/bindings-wrapper-how-to/115973/4 "2007-10-01T13:02:12Z")

</div>

John J. 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.

---

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [October 1, 2007, 6:35am UTC](https://www.ruby-forum.com/t/bindings-wrapper-how-to/115973/5 "2007-10-01T06:35:26Z")

</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.
