1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
ngoto 2012-12-04 09:55:07 +00:00
parent b6b8960018
commit 34422887c2
2 changed files with 19 additions and 4 deletions

View file

@ -1,3 +1,10 @@
Tue Dec 4 18:21:04 2012 Naohisa Goto <ngotogenome@gmail.com>
* 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.
Tue Dec 4 18:05:58 2012 Naohisa Goto <ngotogenome@gmail.com>
* ext/fiddle/lib/fiddle/types.rb: copied from ext/dl/lib/dl/types.rb

View file

@ -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