Sha256: a7cd80a7791cfa327e9090de4d4841e064d9c98222602b2d1d914f4002d37339

Contents?: true

Size: 704 Bytes

Versions: 2

Compression:

Stored size: 704 Bytes

Contents

require 'ffi'
require 'ffi/library'

module FFI
  # Redefining #attach_function so we can avoid bombing out if a called method
  # is not defined.
  module Library
    alias_method :old_attach_function, :attach_function

    def attach_function(*args)
      old_attach_function(*args)
    rescue FFI::NotFoundError
      @unsupported_gdal_functions ||= []

      if $VERBOSE || ENV['VERBOSE']
        warn "ffi-gdal warning: function '#{args.first}' is not available in this build of GDAL/OGR (v#{FFI::GDAL.GDALVersionInfo('RELEASE_NAME')})"
      end

      @unsupported_gdal_functions << args.first
    end

    def unsupported_gdal_functions
      @unsupported_gdal_functions ||= []
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta5 lib/ext/ffi_library_function_checks.rb
ffi-gdal-1.0.0.beta4 lib/ext/ffi_library_function_checks.rb