In Files

  • dl/lib/dl/win32.rb

Parent

Methods

Win32API

Constants

DLL

Public Class Methods

new(dllname, func, import, export = "0") click to toggle source
 
               # File dl/lib/dl/win32.rb, line 8
def initialize(dllname, func, import, export = "0")
  prototype = (export + import.to_s).tr("VPpNnLlIi", "0SSI").sub(/^(.)0*$/, '\1')
  handle = DLL[dllname] ||= DL::Handle.new(dllname)
  @sym = handle.sym(func, prototype)
end
            

Public Instance Methods

Call(*args) click to toggle source
Alias for: call
call(*args) click to toggle 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
            
Also aliased as: Call