title: ruby FFI does not load DLL on Windows
body: <p>I'm writing a small cross-platform C-library to do geometric calculations. I want to use this library in ruby, because it's approx five times faster than native ruby.</p>
  
  <p>It works fine on Linux (Fedora 20), but when doing the same on Windows 8, it fails with the following error:</p>
  
  <pre><code>C:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.9.3-x86-mingw32/lib/ffi/library.rb:133:in `block in ffi_lib': Could not open library 'libgeom': x▒K. (LoadError) Could not open library 'libgeom.dll':L
          from C:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.9.3-x86-mingw32/lib/ffi/library.rb:100:in `map'
          from C:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.9.3-x86-mingw32/lib/ffi/library.rb:100:in `ffi_lib'
          from C:/rubytest/geom.rb:6:in `&lt;module:Geom&gt;'
          from C:/rubytest/geom.rb:1:in `&lt;top (required)&gt;'
          from main.rb:2:in `require_relative'
          from main.rb:2:in `&lt;main&gt;'
  </code></pre>
  
  <p>In the file geom.rb I have the following:</p>
  
  <pre><code>module Geom
      extend FFI::Library
      ffi_lib "libgeom"
  
      attach_function :point_in_rectangle, [:float, :float, :float, :float, :float, :float], :int
      # etc.
  end
  </code></pre>
  
  <p>In the current directory I have the shared library (libgeom.so on Linux, libgeom.dll on Windows)</p>
  
  <p>I'm compiling the shared library using Cygwin and the following command:</p>
  
  <pre><code>gcc -Wall -shared geom.c -o libgeom.dll
  </code></pre>
  
  <p>I've tried using a complete path for the library, and also tried adding the current directory to PATH, but it makes no difference.</p>
  
  <p>I'm using ruby version:</p>
  
  <pre><code>ruby 1.9.3p545 (2014-02-24) [i386-mingw32]
  </code></pre>
  
  <p>I'm new to ruby, but was very happy with the immediate success on Linux. Now I just want to get it working on Windows too.</p>
  
  <p>Can you suggest any work-around?</p>
  
  <p>Is this a problem with 32-bit versus 64-bit?</p>