Sha256: 84b54b5a02620050e7ea4cb5fe90d28d2cebf0a999dd2d44d6f62a66ee391593
Contents?: true
Size: 1018 Bytes
Versions: 2
Compression:
Stored size: 1018 Bytes
Contents
module Gap class DLLFunction def initialize(path, name) @path = path @name = name end def call(*args) param = args.map do |x| case x when Integer "L" else "p" end end begin Win32API.new(@path, @name, param, "L").call(*args) rescue LoadError Win32API.new(File.expand_path(@path), @name, param, "L").call(*args) end end end class DLL def initialize(filename, sam = Gap::Main, &block) @sam = sam @filename = filename @realpath = @sam.genfile(@filename, &block).tr("/", "\\") end def [](name) DLLFunction.new @realpath, name end def method_missing(sym, *args) self[sym.to_s].call(*args) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gap50-0.1.1 | lib/gap50/gap/dll.rb |
gap50-0.1.0 | lib/gap50/gap/dll.rb |