diff options
author | ngoto <ngoto@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-04 09:55:07 +0000 |
---|---|---|
committer | ngoto <ngoto@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-04 09:55:07 +0000 |
commit | 34422887c2e42866680d289a7207ea4b8cff48fe (patch) | |
tree | 3c1ca8c2140c1a58edfa3687956f14b7d60e934e /test | |
parent | b6b8960018dd87fca321be2b701be7cc934f312d (diff) | |
download | ruby-34422887c2e42866680d289a7207ea4b8cff48fe.tar.gz |
* test/ruby/memory_status.rb (Memory): use fiddle/types if available.
* test/ruby/memory_status.rb (Memory::Win32): :stdcall is needed on
x86 WIN32. This commit partly reverts r38054.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/memory_status.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/test/ruby/memory_status.rb b/test/ruby/memory_status.rb index e8fdad62b7..661756353f 100644 --- a/test/ruby/memory_status.rb +++ b/test/ruby/memory_status.rb @@ -20,7 +20,11 @@ module Memory rescue LoadError require 'dl/import' end - require 'dl/types' + begin + require 'fiddle/types' + rescue LoadError + require 'dl/types' + end module Win32 begin @@ -29,7 +33,11 @@ module Memory extend DL::Importer end dlload "kernel32.dll", "psapi.dll" - include DL::Win32Types + begin + include Fiddle::Win32Types + rescue NameError + include DL::Win32Types + end typealias "SIZE_T", "size_t" PROCESS_MEMORY_COUNTERS = struct [ @@ -47,8 +55,8 @@ module Memory typealias "PPROCESS_MEMORY_COUNTERS", "PROCESS_MEMORY_COUNTERS*" - extern "HANDLE GetCurrentProcess()" - extern "BOOL GetProcessMemoryInfo(HANDLE, PPROCESS_MEMORY_COUNTERS, DWORD)" + extern "HANDLE GetCurrentProcess(), :stdcall" + extern "BOOL GetProcessMemoryInfo(HANDLE, PPROCESS_MEMORY_COUNTERS, DWORD), :stdcall" module_function def memory_info |