mirror of
https://github.com/ruby/ruby.git
synced 2025-09-20 11:03:58 +02:00
* ext/fiddle/*: Adding fiddle library to wrap libffi
* test/fiddle/*: testing fiddle extension * ext/dl/lib/dl.rb: Requiring fiddle if it is available * ext/dl/lib/dl/callback.rb: using Fiddle if it is available * ext/dl/lib/dl/func.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ca3c007f05
commit
4bada8b864
22 changed files with 1084 additions and 71 deletions
17
ext/fiddle/lib/fiddle/closure.rb
Normal file
17
ext/fiddle/lib/fiddle/closure.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
module Fiddle
|
||||
class Closure
|
||||
attr_reader :ctype
|
||||
attr_reader :args
|
||||
|
||||
class BlockCaller < Fiddle::Closure
|
||||
def initialize ctype, args, abi = Fiddle::Function::DEFAULT, &block
|
||||
super(ctype, args, abi)
|
||||
@block = block
|
||||
end
|
||||
|
||||
def call *args
|
||||
@block.call(*args)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
5
ext/fiddle/lib/fiddle/function.rb
Normal file
5
ext/fiddle/lib/fiddle/function.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
module Fiddle
|
||||
class Function
|
||||
attr_reader :abi
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue