The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
RubyCocoa and libffi

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
Laurent Sansonetti

Posts: 134
Nickname: lrz
Registered: Jun, 2006

Laurent Sansonetti is a software engineer at Apple Computer and a longtime Ruby enthusiast.
RubyCocoa and libffi Posted: Sep 14, 2006 8:01 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Laurent Sansonetti.
Original Post: RubyCocoa and libffi
Feed Title: lrz's diary
Feed URL: http://www.chopine.be/lrz/diary/xml/rss/feed.xml
Feed Description: lrz's diary
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Laurent Sansonetti
Latest Posts From lrz's diary

Advertisement

I have been busy the latest days experimenting the usage of the libffi library inside RubyCocoa. If you don't know about libffi, it's a library part of the GCC project to call arbitrary C functions at runtime, stacking the parameters for you depending on their type and the architecture. The PyObjC project is using it since years, so there was no reason why we shouldn't :)

My work is visible in the libffi-experiment branch. libffi is used to callback C functions from Ruby, and to forward messages from Ruby to Objective-C. The latter is important, as we replaced the previous NSInvocation-based mechanism (that creates and sends several Objective-C objects and messages) by this pure-C library. And we don't even use objc_msgSend[v], we directly retrieve the IMP function pointer and branch it through libffi, as we don't care anymore about argument types. This is great for performances, I will do some serious benchmarking in the very near future and post the results.

On another note, this branch has some preliminary work about a more dynamic bringing idea. Instead of generating static code for all the non-introspectable stuff (C functions, constants, enums...) at build time, an XML file that describes all these details is instead produced (one per framework), and RubyCocoa at runtime parses them and do the necessary linkage. Symbols are lazily localized (at demand). This way is more dynamic, as you don't have to rebuild RubyCocoa each time you want to support a new framework, or when an already-supported framework changed. A tool has been written to generate the XML metadata, and you can use it to support your own framework.

Very exciting stuff in the RubyCocoa land in perspective...

Read: RubyCocoa and libffi

Topic: Ruby test categorization techniques Previous Topic   Next Topic Topic: Struggle with Ruby on Rails String.to_json

Sponsored Links



Google
  Web Artima.com   

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