module FFI::Library

Redefining attach_function so we can avoid bombing out if a called method is not defined.

Public Instance Methods

attach_function(*args) click to toggle source
# File lib/ext/ffi_library_function_checks.rb, line 12
def attach_function(*args)
  old_attach_function(*args)
rescue FFI::NotFoundError
  @unsupported_gdal_functions ||= []

  if $VERBOSE || ENV.fetch("VERBOSE", nil)
    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
Also aliased as: old_attach_function
old_attach_function(*args)
Alias for: attach_function
unsupported_gdal_functions() click to toggle source
# File lib/ext/ffi_library_function_checks.rb, line 25
def unsupported_gdal_functions
  @unsupported_gdal_functions ||= []
end