This commit adds two new methods, Fiddle::Pointer.read and Fiddle::Pointer.write. Both methods take an address, and will read or write bytes at that address respectively.
For example we can read from an address without making a Pointer object:
Fiddle::Pointer.read(address,5)# read 5 bytes
We can also write to an address without allocating a Pointer object:
[ruby/fiddle] Add a helper method for reading/writing memory
(https://github.com/ruby/fiddle/pull/123)
This commit adds two new methods,
Fiddle::Pointer.readandFiddle::Pointer.write. Both methods take an address, and will read orwrite bytes at that address respectively.
For example we can read from an address without making a Pointer object:
We can also write to an address without allocating a Pointer object:
This allows us to read / write memory at arbitrary addresses without
instantiating a new
Fiddle::Pointerobject.Examples where this API would be useful
1
2
3
I also added a writer method for the same reasons as the reader.
https://github.com/ruby/fiddle/commit/04238cefed
Co-authored-by: Sutou Kouhei kou@clear-code.com