diff options
Diffstat (limited to 'ext/dl/lib/dl/win32.rb')
-rw-r--r-- | ext/dl/lib/dl/win32.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/ext/dl/lib/dl/win32.rb b/ext/dl/lib/dl/win32.rb new file mode 100644 index 0000000000..b507be5fde --- /dev/null +++ b/ext/dl/lib/dl/win32.rb @@ -0,0 +1,26 @@ +# -*- ruby -*- + +require 'dl' + +class Win32API + LIBRARY = {} + + attr_reader :val, :args + + def initialize(lib, func, args, ret) + LIBRARY[lib] ||= DL.dlopen(lib) + ty = (ret + args).tr('V','0') + @sym = LIBRARY[lib].sym(func, ty) + @__dll__ = LIBRARY[lib].to_i + @__dllname__ = lib + @__proc__ = @sym.to_i + @val = nil + @args = [] + end + + def call(*args) + @val,@args = @sym.call(*args) + return @val + end + alias Call call +end |