diff options
author | ttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-04-02 10:56:13 +0000 |
---|---|---|
committer | ttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-04-02 10:56:13 +0000 |
commit | 7d711b817e62eb6c8dee01ea2283fcb1ad90f8ac (patch) | |
tree | b1b54ab76217775071de4e3669674aa7887aa6b9 /ext/dl/lib/dl/win32.rb | |
parent | 64b6406445e53f187d2982f87becff8065edd0cc (diff) |
Add ruby-dl
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 |