Class: Gap::DLLFunction

Inherits:
Object
  • Object
show all
Defined in:
lib/gap50/gap/dll.rb

Instance Method Summary collapse

Constructor Details

#initialize(path, name) ⇒ DLLFunction

Returns a new instance of DLLFunction.



3
4
5
6
# File 'lib/gap50/gap/dll.rb', line 3

def initialize(path, name)
    @path = path
    @name = name
end

Instance Method Details

#call(*args) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/gap50/gap/dll.rb', line 8

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