summaryrefslogtreecommitdiff
path: root/ext/dl/lib/dl
diff options
context:
space:
mode:
Diffstat (limited to 'ext/dl/lib/dl')
-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 1ec34b7cf3..7a8b62e325 100644
--- a/ext/dl/lib/dl/func.rb
+++ b/ext/dl/lib/dl/func.rb
@@ -95,6 +95,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 bb8348cf5e..56dfcefa32 100644
--- a/ext/dl/lib/dl/value.rb
+++ b/ext/dl/lib/dl/value.rb
@@ -63,6 +63,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