Module: GRCommons::TryExtern
Overview
This module records the names of the methods defined by Fiddle::Importer.
Instance Attribute Summary collapse
-
#ffi_methods ⇒ Object
readonly
Returns the value of attribute ffi_methods.
Instance Method Summary collapse
-
#try_extern(signature, *opts) ⇒ Object
Improved extern method.
Instance Attribute Details
#ffi_methods ⇒ Object (readonly)
Returns the value of attribute ffi_methods.
6 7 8 |
# File 'lib/gr_commons/try_extern.rb', line 6 def ffi_methods @ffi_methods end |
Instance Method Details
#try_extern(signature, *opts) ⇒ Object
Improved extern method.
-
Ignore functions that cannot be attached.
-
Available function (names) are stored in @ffi_methods.
For compatibility with older versions of GR.
12 13 14 15 16 17 18 19 20 21 |
# 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 Fiddle::DLError => e warn "#{e.class.name}: #{e.}" if $VERBOSE end end |