Subject: Re: [ruby-ffi] Re: Towards a 1.0 API for Ruby FFI |
From: Evan Phoenix |
Date: 12/16/09 2:30 AM |
To: ruby-ffi@googlegroups.com |
On Dec 15, 2009, at 10:49 PM, Luis Lavena wrote:
<costan@gmail.com> wrote:On Wed, Dec 16, 2009 at 3:21 AM, Victor CostanIs it feasible to make "FFI.add_sys_types" available on all platforms if it's implemented at runtime?You just made me discard my previous message. I was going to ask exactly the same thing. I believe these values should be computed at build time and not at runtime. runtime calculation and shelling out is a hidden requirement and add complexity to debug it. Even you put guards to avoid errors, expect bug reports about these sys types being missing from people not having the development tools for their platforms at hand.
Fully agree. My intention was not to mean that FFI.add_sys_types would begin parsing header files right then figure out the results. Only that the by hiding it behind a method, every implementation is free to make the best decision about how they want to import them. I'd imagine that typically, ruby-ffi would calculate these values at build time and put them in either a .rb file that you include, or perhaps the FFI.add_sys_types method would be a C method that adds the types, thereby using the compiler itself to do most of the work. Again, the method is a simple abstraction to allow each implementation the most flexibility with the least pain.
I'm thinking ideally the ffi gem will come prebuilt, at least for OSX and Windows, so users might not have Xcode / mingw / Vistual Studio. To me, the biggest advantage of using ffi is not having to deal with all the extension building stuff on a per-gem basis.On this field, I'm working on adding an option to rake-compiler to use and abuse of RVM and Pik to build fat binaries on all the platforms, for anyone that cares. Cheers, -- Luis Lavena AREA 17 - Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away. Antoine de Saint-Exupéry