method
new
v1_9_3_125 -
Show latest stable
- Class:
DL::Function
new(cfunc, argtypes, abi = nil, &block)public
No documentation available.
# File ext/dl/lib/dl/func.rb, line 14
def initialize cfunc, argtypes, abi = nil, &block
if DL.fiddle?
abi ||= Fiddle::Function::DEFAULT
if block_given?
@cfunc = Class.new(Fiddle::Closure) {
define_method(:call, block)
}.new(cfunc.ctype, argtypes)
else
@cfunc = cfunc
end
@args = argtypes
super(@cfunc, @args.reject { |x| x == TYPE_VOID }, cfunc.ctype, abi)
else
@cfunc = cfunc
@stack = Stack.new(argtypes.collect{|ty| ty.abs})
if( @cfunc.ctype < 0 )
@cfunc.ctype = @cfunc.ctype.abs
@unsigned = true
else
@unsigned = false
end
if block_given?
bind(&block)
end
end
end