Sha256: d4aa06b5c08b056dd3a44000f1fd37ca919ed2e389931e5141bf5a5ef7745abc

Contents?: true

Size: 1.15 KB

Versions: 37

Compression:

Stored size: 1.15 KB

Contents

require 'ffi/ffi'

# Patch any missing methods

module FFI
  class Pointer

    def write_pointer(ptr)
      put_pointer(0, ptr)
    end unless method_defined?(:write_pointer)

    def read_array_of_pointer(length)
      read_array_of_type(:pointer, :read_pointer, length)
    end unless method_defined?(:read_array_of_pointer)

    def write_array_of_pointer(ary)
      write_array_of_type(:pointer, :write_pointer, ary)
    end unless method_defined?(:write_array_of_pointer)

  end

  # Fix for RUBY-3527
  if JRUBY_VERSION >= "1.2.0" && JRUBY_VERSION < "1.3.0"
    module Library
      def ffi_lib(*names)
        ffi_libs = []
        names.each do |name|
          [ name, FFI.map_library_name(name) ].each do |libname|
            begin
              lib = FFI::DynamicLibrary.open(libname, FFI::DynamicLibrary::RTLD_LAZY | FFI::DynamicLibrary::RTLD_GLOBAL)
              if lib
                ffi_libs << lib
                break
              end
            rescue LoadError => ex
            end
          end
        end
        raise LoadError, "Could not open any of [#{names.join(", ")}]" if ffi_libs.empty?
        @ffi_libs = ffi_libs
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 3 rubygems

Version Path
ffi-1.1.5-java lib/ffi.rb
ffi-1.1.4-java lib/ffi.rb
ffi-1.1.3-java lib/ffi.rb
ffi-1.1.2-java lib/ffi.rb
ffi-1.1.1-java lib/ffi.rb
ffi-1.1.0-java lib/ffi.rb
redcar-0.13 vendor/ffi-1.0.11-java/lib/ffi.rb
redcar-dev-0.13.5dev vendor/ffi-1.0.11-java/lib/ffi.rb
redcar-dev-0.13.4dev vendor/ffi-1.0.11-java/lib/ffi.rb
redcar-dev-0.13.3dev vendor/ffi-1.0.11-java/lib/ffi.rb
redcar-dev-0.13.2dev vendor/ffi-1.0.11-java/lib/ffi.rb
redcar-dev-0.13.1dev vendor/ffi-1.0.11-java/lib/ffi.rb
redcar-0.12.1 vendor/ffi-1.0.11-java/lib/ffi.rb
redcar-dev-0.13.0dev vendor/ffi-1.0.11-java/lib/ffi.rb
redcar-0.12 vendor/ffi-1.0.11-java/lib/ffi.rb
redcar-dev-0.12.27dev vendor/ffi-1.0.11-java/lib/ffi.rb
redcar-dev-0.12.26dev vendor/ffi-1.0.11-java/lib/ffi.rb
ffi-1.0.11-java lib/ffi.rb
ffi-1.0.10-java lib/ffi.rb
ffi-1.0.9-java lib/ffi.rb