summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/dl/lib/dl/func.rb4
-rw-r--r--ext/dl/lib/dl/value.rb2
2 files changed, 6 insertions, 0 deletions
diff --git a/ext/dl/lib/dl/func.rb b/ext/dl/lib/dl/func.rb
index a2e6d40fbe..f0e1ca71ee 100644
--- a/ext/dl/lib/dl/func.rb
+++ b/ext/dl/lib/dl/func.rb
@@ -97,6 +97,10 @@ module DL
end
end
+ def bound?()
+ @cfunc.ptr != 0
+ end
+
def bind_at_call(&block)
bind(&block)
end
diff --git a/ext/dl/lib/dl/value.rb b/ext/dl/lib/dl/value.rb
index aa7e0dd325..254e1921ce 100644
--- a/ext/dl/lib/dl/value.rb
+++ b/ext/dl/lib/dl/value.rb
@@ -61,6 +61,8 @@ module DL
if( block )
arg.bind_at_call(&block)
funcs.push(arg)
+ elsif !arg.bound?
+ raise(RuntimeError, "block must be given.")
end
return arg.to_i
when String