method
new
v1_9_3_125 -
Show latest stable
-
0 notes -
Class: Function
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (0)
- 2_2_9
- 2_4_6
- 2_5_5
- 2_6_3
- What's this?
new(cfunc, argtypes, abi = nil, &block)
public
Hide source
# 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