ext/dl/lib/dl/win32.rb


DEFINITIONS

This source file includes following functions.


   1  # -*- ruby -*-
   2  
   3  require 'dl'
   4  
   5  class Win32API
   6    LIBRARY = {}
   7  
   8    attr_reader :val, :args
   9  
  10    def initialize(lib, func, args, ret)
  11      LIBRARY[lib] ||= DL.dlopen(lib)
  12      ty = (ret + args).tr('V','0')
  13      @sym = LIBRARY[lib].sym(func, ty)
  14      @__dll__ = LIBRARY[lib].to_i
  15      @__dllname__ = lib
  16      @__proc__ = @sym.to_i
  17      @val = nil
  18      @args = []
  19    end
  20  
  21    def call(*args)
  22      @val,@args = @sym.call(*args)
  23      return @val
  24    end
  25    alias Call call
  26  end