Flowdock
method

new

Importance_0
v1_9_3_392 - Show latest stable - 0 notes - Class: Function
new(cfunc, argtypes, abi = nil, &block) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File ext/dl/lib/dl/func.rb, line 51
    def initialize cfunc, argtypes, abi = nil, &block
      if DL.fiddle?
        abi ||= CALL_TYPE_TO_ABI[(cfunc.calltype rescue nil)]
        if block_given?
          @cfunc = Class.new(FiddleClosureCFunc) {
            define_method(:call, block)
          }.new(cfunc.ctype, argtypes, abi, cfunc.name)
        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
Register or log in to add new notes.