mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 21:14:23 +02:00
[ruby/fiddle] Implement Fiddle::Pointer.read
and .write
on the
FFI backend
(https://github.com/ruby/fiddle/pull/165)
0bd963d3b8
This commit is contained in:
parent
0c7fe4b092
commit
473fb6385e
2 changed files with 8 additions and 4 deletions
|
@ -261,6 +261,14 @@ module Fiddle
|
|||
end
|
||||
end
|
||||
|
||||
def self.write(addr, bytes)
|
||||
FFI::Pointer.new(addr).write_bytes(bytes)
|
||||
end
|
||||
|
||||
def self.read(addr, len)
|
||||
FFI::Pointer.new(addr).read_bytes(len)
|
||||
end
|
||||
|
||||
class << self
|
||||
alias [] to_ptr
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue