summaryrefslogtreecommitdiff
path: root/ext/dl/lib/dl
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-02-16 02:05:46 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-02-16 02:05:46 +0000
commit8f8947a260891f265d4f3881f6ebac7fbbc96d7a (patch)
treeaefc68d6bc2c9e8e3693e420952544cf1515c694 /ext/dl/lib/dl
parent1e7d74f39ed82dc0f1044d30f51237592f1a6131 (diff)
downloadruby-8f8947a260891f265d4f3881f6ebac7fbbc96d7a.tar.gz
* ext/dl/method.c: Adding DL::Method as a superclass for DL::Function
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl/lib/dl')
-rw-r--r--ext/dl/lib/dl/func.rb6
-rw-r--r--ext/dl/lib/dl/value.rb13
2 files changed, 3 insertions, 16 deletions
diff --git a/ext/dl/lib/dl/func.rb b/ext/dl/lib/dl/func.rb
index 0ee2df1f23..c5a2dda355 100644
--- a/ext/dl/lib/dl/func.rb
+++ b/ext/dl/lib/dl/func.rb
@@ -6,7 +6,7 @@ require 'dl/value'
require 'thread'
module DL
- class Function
+ class Function < DL::Method
include DL
include ValueUtil
@@ -20,7 +20,7 @@ module DL
end
@args = argtypes
- native_init(@args.reject { |x| x == TYPE_VOID }, cfunc.ctype, abi)
+ super(@cfunc, @args.reject { |x| x == TYPE_VOID }, cfunc.ctype, abi)
end
def to_i()
@@ -35,7 +35,7 @@ module DL
if block_given?
args.find { |a| DL::Function === a }.bind_at_call(&block)
end
- native_call(*args)
+ super
end
def wrap_result(r)
diff --git a/ext/dl/lib/dl/value.rb b/ext/dl/lib/dl/value.rb
index c613afe5cf..cc6da6a7fb 100644
--- a/ext/dl/lib/dl/value.rb
+++ b/ext/dl/lib/dl/value.rb
@@ -36,19 +36,6 @@ module DL
end
end
- def ruby2ffi arg, type
- return arg unless type == TYPE_VOIDP
- case arg
- when nil
- 0
- when CPtr
- arg.to_i
- else
- CPtr[arg].to_i
- end
- end
- private :ruby2ffi
-
def wrap_arg(arg, ty, funcs = [], &block)
funcs ||= []
case arg