class RbReadline::Win32API

Constants

CALL_TYPE_TO_ABI
DLL
TYPEMAP

Public Class Methods

new(dllname, func, import, export = "0", calltype = :stdcall) click to toggle source
# File lib/rbreadline.rb, line 4431
def initialize(dllname, func, import, export = "0", calltype = :stdcall)
  @proto = import.join.tr("VPpNnLlIi", "0SSI").chomp('0').split('')
  handle = DLL[dllname] ||= Fiddle.dlopen(dllname)
  @func = Fiddle::Function.new(handle[func], TYPEMAP.values_at(*@proto), CALL_TYPE_TO_ABI[calltype])
end

Public Instance Methods

Call(*args)
Alias for: call
call(*args) click to toggle source
# File lib/rbreadline.rb, line 4437
def call(*args)
  args.each_with_index do |x, i|
    args[i], = [x == 0 ? nil : x].pack("p").unpack("l!*") if @proto[i] == "S" && !x.is_a?(Fiddle::Pointer)
    args[i], = [x].pack("I").unpack("i") if @proto[i] == "I"
  end
  @func.call(*args).to_i || 0
end
Also aliased as: Call