From: Charles Oliver Nutter Date: 2008-11-05T04:02:50+09:00 Subject: Re: FFI 0.1.1 (Foreign Function Interface) for Ruby 1.8.6/7 and 1.9 Nit Khair wrote: > Sean O'halpin wrote: >> On Tue, Nov 4, 2008 at 2:38 PM, Ken Bloom wrote: > >> module NCursesFFI >> extend FFI::Library >> ffi_lib 'ncurses' >> attach_function 'clear', [], :int >> attach_function 'endwin', [], :int >> attach_function 'getch', [], :int >> attach_function 'initscr', [], :int >> attach_function 'printw', [ :string ], :int >> attach_function 'refresh', [], :int >> end >> > > Sean, > Going by the above, and the samples of structs on the blog, for a medium > sized library such as ncurses, there can be some effort in getting this > module ready. Will there be some kind of repository of such modules, so > we are not duplicating each others effort ? I'd recommend folks start releasing FFI-based "thin wrappers" for each library they come across, and then depend on that gem. Don't go over the top...just get the basic bindings in there, structs, tests to make sure it's all working, and release a gem. Then build nice APIs on top of that, separately. One of my biggest gripes about C extensions in Ruby is that everyone feels the need to release their own wrapper PLUS Ruby-like API in a single gem, when just releasing the wrapper would allow a lot more experimentation. So you end up with multiple people writing their own extensions with their own APIs and little sharing. If we just get a whole ton of, simple, clean wrappers out there, the APIs will surely follow. - Charlie