summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-05 23:38:35 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-05 23:38:35 +0000
commitff10d93563e740d02a7a9815df9bd7b7d4b6d3d5 (patch)
treeb912b3d1fe7e47b3bcbfa4efc673604c2376792d /ext
parentc27e0ebab690d2a6c709a5a2c83af2d7a4968492 (diff)
* ext/dl/lib/dl/import.rb (handler): add a more helpful error message
when calling import_symbol or import_function without calling dlload. Thanks nobu! [ruby-core:30996] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/dl/lib/dl/import.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/dl/lib/dl/import.rb b/ext/dl/lib/dl/import.rb
index fd23bc9676..f9e8faf5f0 100644
--- a/ext/dl/lib/dl/import.rb
+++ b/ext/dl/lib/dl/import.rb
@@ -194,8 +194,12 @@ module DL
return ptr
end
+ def handler
+ @handler or raise "call dlload before importing symbols and functions"
+ end
+
def import_symbol(name)
- addr = @handler.sym(name)
+ addr = handler.sym(name)
if( !addr )
raise(DLError, "cannot find the symbol: #{name}")
end
@@ -203,7 +207,7 @@ module DL
end
def import_function(name, ctype, argtype, call_type = nil)
- addr = @handler.sym(name)
+ addr = handler.sym(name)
if( !addr )
raise(DLError, "cannot find the function: #{name}()")
end