summaryrefslogtreecommitdiff
path: root/ext/dl/lib/dl/func.rb
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-17 03:42:19 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-17 03:42:19 +0000
commit4a097d2e3e37e66f0cac4db3d4916d673fcb0129 (patch)
treeef493afa973c7de20f0ae3e0264ba647abc41c00 /ext/dl/lib/dl/func.rb
parent211525d7102a562bb14259dbf11602021a09306c (diff)
* ext/dl/lib/dl/func.rb (DL::Function#bind): allow to return/break from
the callback method. (Fiddle already allows it.) [Bug #6389] [ruby-dev:45604] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl/lib/dl/func.rb')
-rw-r--r--ext/dl/lib/dl/func.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/dl/lib/dl/func.rb b/ext/dl/lib/dl/func.rb
index 3c2245f413..c80cf8a9e1 100644
--- a/ext/dl/lib/dl/func.rb
+++ b/ext/dl/lib/dl/func.rb
@@ -90,6 +90,9 @@ module DL
if( !block )
raise(RuntimeError, "block must be given.")
end
+ unless block.lambda?
+ block = Class.new{define_method(:call, block)}.new.method(:call)
+ end
if( @cfunc.ptr == 0 )
cb = Proc.new{|*args|
ary = @stack.unpack(args)