On Tue, 04 Nov 2008 14:02:50 -0500, Charles Oliver Nutter wrote: > Nit Khair wrote: >> Sean O'halpin wrote: >>> On Tue, Nov 4, 2008 at 2:38 PM, Ken Bloom <kbloom / gmail.com> 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 The good news is that unlike C libraries, if someone bundles their own wrapper with their own API, you can still get at the wrapper, by finding the module that imports FFI and just using that. -- Chanoch (Ken) Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/