diff options
-rw-r--r-- | lib/e17/ffi_helper.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/e17/ffi_helper.rb b/lib/e17/ffi_helper.rb new file mode 100644 index 0000000..36c9c6b --- /dev/null +++ b/lib/e17/ffi_helper.rb @@ -0,0 +1,27 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +require 'ffi' +# +module FFIHelper + def attach_fcts + @fcts.each do |func| + begin + attach_function *func + rescue Object => e + puts "Could not attach #{func} #{e.message}" + end + end + end + def create_aliases l + @fcts.each do |f,a,r| + module_eval <<-code + class << self + alias #{f.to_s[l..-1]} #{f} + end + code + end + end +end +# +# EOF |