Module: FFI::GNUExtensions::DLV
- Defined in:
- lib/ffi/gnu_extensions.rb
Overview
Override FFI::Library attach functions with support for dlvsym
Instance Method Summary collapse
-
#ffi_lib_versions(versions) ⇒ Array<String>|String
Set the default version(s) for "#attach_function" (GNU only).
-
#find_function_version(cname, version) ⇒ FFI::Pointer, false
use dlvsym to find a function address.
Instance Method Details
#ffi_lib_versions(versions) ⇒ Array<String>|String
Set the default version(s) for "#attach_function" (GNU only)
50 51 52 |
# File 'lib/ffi/gnu_extensions.rb', line 50 def ffi_lib_versions(versions) @versions = versions end |
#find_function_version(cname, version) ⇒ FFI::Pointer, false
use dlvsym to find a function address
99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/ffi/gnu_extensions.rb', line 99 def find_function_version(cname, version) ffi_libraries.map(&:name).each do |l| handle = GNUExtensions.dlopen(l, 1) next if handle.null? addr = GNUExtensions.dlvsym(handle, cname.to_s, version) next if addr.null? return addr end false end |