зеркало из https://github.com/github/ruby.git
* 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:
Родитель
b6b8960018
Коммит
34422887c2
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче