Module: Vigilem::Win32API::Types::PVOID

Extended by:
FFI::DataConverter
Defined in:
lib/vigilem/win32_api/types.rb

Class Method Summary collapse

Class Method Details

.from_native(value, ctx) ⇒ Bignum, Integer

Converts the specified value from the native type.

Returns:

  • (Bignum, Integer)


31
32
33
# File 'lib/vigilem/win32_api/types.rb', line 31

def from_native(value, ctx)
  value.address
end

.to_native(value, ctx) ⇒ ::FFI::Pointer

Converts the specified value to the native type.

Returns:

  • (::FFI::Pointer)


37
38
39
40
41
42
43
44
45
46
# File 'lib/vigilem/win32_api/types.rb', line 37

def to_native(value, ctx)
  case
  when value.kind_of?(::FFI::Pointer)
    value
  when value.kind_of?(::FFI::Struct)
    value.to_ptr
  else
    ::FFI::Pointer.new(value.to_i)
  end
end