Sha256: 978135eeecfb9ae555f41e874a3863575633ad301334998f49b3d7bf4068f709

Contents?: true

Size: 740 Bytes

Versions: 9

Compression:

Stored size: 740 Bytes

Contents

# frozen_string_literal: true

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 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

9 entries across 9 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta16 lib/ext/ffi_library_function_checks.rb
ffi-gdal-1.0.0.beta15 lib/ext/ffi_library_function_checks.rb
ffi-gdal-1.0.0.beta14 lib/ext/ffi_library_function_checks.rb
ffi-gdal-1.0.0.beta13 lib/ext/ffi_library_function_checks.rb
ffi-gdal-1.0.0.beta12 lib/ext/ffi_library_function_checks.rb
ffi-gdal-1.0.0.beta11 lib/ext/ffi_library_function_checks.rb
ffi-gdal-1.0.0.beta10 lib/ext/ffi_library_function_checks.rb
ffi-gdal-1.0.0.beta9 lib/ext/ffi_library_function_checks.rb
ffi-gdal-1.0.0.beta8 lib/ext/ffi_library_function_checks.rb