module GRCommons::TryExtern

This module records the names of the methods defined by Fiddle::Importer.

Attributes

ffi_methods[R]

Public Instance Methods

try_extern(signature, *opts) click to toggle source

Improved extern method.

  1. Ignore functions that cannot be attached.

  2. Available function (names) are stored in @ffi_methods.

For compatiblity with older versions of GR.

# File lib/gr_commons/try_extern.rb, line 12
def try_extern(signature, *opts)
  @ffi_methods ||= []
  begin
    func = extern(signature, *opts)
    @ffi_methods << func.name
    func
  rescue StandardError => e
    warn "#{e.class.name}: #{e.message}"
  end
end