diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-04-14 06:23:43 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-04-14 06:23:43 +0200 |
commit | 38a8992822c638ded9db7e3b1ae5aa28dee38fab (patch) | |
tree | 360bf81dd920b0f4320013ee1948e85e3ac841e2 /lib/e17/ffi_helper.rb | |
parent | 11725c389157c789edac1572a86c5542909900c4 (diff) | |
download | ffi-efl-38a8992822c638ded9db7e3b1ae5aa28dee38fab.zip ffi-efl-38a8992822c638ded9db7e3b1ae5aa28dee38fab.tar.gz |
add ffi_helper
Diffstat (limited to 'lib/e17/ffi_helper.rb')
-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 |