2010/4/26 Yugui <yugui / yugui.jp>:
> 2010/4/26 Aaron Patterson <aaron.patterson / gmail.com>:
>> 皆さんの立場他に何もご意見が無ければ、私はこのパッチをruby repository
>> にコミットします。それと、必要であれば私の方で、rubyとlibffiの解析方法をwikiに追加しますのでお知らせください。
>
> Great!
> But wait a moment before committing because unak, the maintainer for
> mswin32, opposes. I regard mswin32 platform important and maintenance
> by unak is necessary for Ruby's working on it.  I can not accept any
> solution on win32 which unak oppose.
>
> He said:
>> 例えばリリースされたことがなくてsvnで取ってくるしかないものに
>> 依存させます、とか言われたら猛反対しますね。
>
> So libffi-msvc is not acceptable as a solution for dl because
> libffi-msvc is not an official release of the libffi project. (Is this
> right?)

I believe that is correct, but the patches have been merged to FFI.

> I talked with unak and some committers about the problem, and
> recommend  the following solution.
> * Imports your work as ext/dl-ffi
> * Renames ext/dl as ext/dl2
> * Writes a wrapper library ext/dl. It loads ext/dl-ffi if available,
> or loads ext/dl2.
>
> Is this possible?  I want to help if I have something to do for it.

Yes, this is possible.  I think there might be an easier way though.
I created "ext/fiddle" (FFI + DL sounds like "fiddle").  Fiddle only
wraps libffi, and uses DL::CPtr for wrapping pointers.  Then I patched
DL to optionally use Fiddle if it's available.

You can see it here:

  http://github.com/tenderlove/ruby/tree/fiddle
  http://github.com/tenderlove/ruby/tree/fiddle/ext/fiddle/
  http://github.com/tenderlove/ruby/blob/fiddle/ext/dl/lib/dl.rb

For systems with libffi available, DL will use Fiddle as the back end.
 How is that?

-- 
Aaron Patterson
http://tenderlovemaking.com/