Class: Win32API

Class | Win32API
In: | dl/lib/dl/win32.rb
Parent: | Object

### Methods

Call call new

### Constants

DLL | = | {}

### Public Class methods

new(dllname, func, import, export = "0")

[Source]

    # File dl/lib/dl/win32.rb, line 8
      def initialize(dllname, func, import, export = "0")
        prototype = (export + import.to_s).tr("VPpNnLlIi", "0SSI")
        handle = DLL[dllname] ||= DL::Handle.new(dllname)
        @sym = handle.sym(func, prototype)
      end

### Public Instance methods

Call(*args)

Alias for call

call(*args)

[Source]

    # File dl/lib/dl/win32.rb, line 14
      def call(*args)
        import = @sym.proto.split("", 2)[1]
        args.each_with_index do |x, i|
          args[i] = nil if x == 0 and import[i] == ?S
          args[i], = [x].pack("I").unpack("i") if import[i] == ?I
        end
        ret, = @sym.call(*args)
        return ret || 0
      end

[Validate]