[BioRuby] FFI to Smith/Waterman and Needleman/Wunsh C-extension

Chase Miller chmille4 at gmail.com
Tue Feb 22 20:11:48 UTC 2011


My understanding is that a C extension ships the source and compiles on gem
installation, whereas FFI requires multiple pre-compiled shared libraries
(one for each supported platform) to ship with the gem.  Maintaining all
those shared libraries sounds like a lot of work.

I'm not sure I understand why FFI is preferred; could someone explain it a
little more in detail?

Chase

On Tue, Feb 22, 2011 at 2:43 PM, Michael Barton <mail at michaelbarton.me.uk>wrote:

> That's useful to know. I was familiar with FFI but I didn't know it was the
> preferred approach in Ruby. I'm learning C and hoping to use it where
> necessary
> for solving bottle necks.
>
> On Tue, Feb 22, 2011 at 07:47:41PM +0100, Pjotr Prins wrote:
> > On Tue, Feb 22, 2011 at 11:48:21AM -0500, Michael Barton wrote:
> > > Thank you Naohisa and Francesco for your suggestions. I will try
> > > experimenting with these two libraries. I had also just read an
> interesting
> > > article on using C extensions in Ruby which I thought might be of
> general
> > > interest to the mailing list -
> > >
> > > http://robots.thoughtbot.com/post/1037240922
> >
> > This discusses using a Ruby C interface. Note: it is not the easiest way.
> > Especially with existing C libs you may be better off with FFI or SWIG.
> The
> > first makes mapping to Ruby easy, the second maps to all languages. For
> most
> > Ruby bindings FFI is preferred, also because it does JRuby.
> >
> > Binding existing libraries is usually non-trivial. Because C has no GC,
> and
> > buffers get passed around as function parameters.
> >
> > Pj.
>
> _______________________________________________
> BioRuby Project - http://www.bioruby.org/
> BioRuby mailing list
> BioRuby at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioruby
>
>



More information about the BioRuby mailing list