The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
More FFI

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Daniel Berger

Posts: 1383
Nickname: djberg96
Registered: Sep, 2004

Daniel Berger is a Ruby Programmer who also dabbles in C and Perl
More FFI Posted: Dec 14, 2011 11:27 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Daniel Berger.
Original Post: More FFI
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Daniel Berger
Latest Posts From Testing 1,2,3...

Advertisement
Lately I've converted a few of my smaller Ruby libraries that were using C extensions to use the ffi gem. Specifically, sys-cpu, sys-uname and sys-uptime now all use FFI behind the scenes. They all now work with JRuby, too. Yay.

I'm still not enamored with FFI, though. It has added some features for automatic struct allocation which is good, but it still has most of the issues I complained about originally. In fact, another issue I didn't mention last time is that there's no way to automatically import simple macro definitions from header files. This again means manually inspecting header files if you want to use sensical constant names instead of raw numbers. To make matters worse, sometimes different platforms have the same macro with different values. To wit HW_MACHINE_ARCH is set to 11 on BSD, but 12 on other platforms. Fun.

And, converting those three gems to use FFI took much, much longer than it should have. It's still much easier for me to use C extensions. So, my more complex C extensions will not be converted any time soon, and probably only if I'm actually paid to do it.

Read: More FFI

Topic: More FFI Previous Topic   Next Topic Topic: Packaging from a gemspec is not the Best Way

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use