[ruby/fiddle] Add "offsetof" to Struct classes (https://github.com/ruby/fiddle/pull/83)
I need to get the offset of a member inside a struct without allocating the struct. This patch adds an "offsetof" class method to structs that are generated.
The usage is like this:
MyStruct = struct [ "int64_t i", "char c", ] MyStruct.offsetof("i") # => 0 MyStruct.offsetof("c") # => 8
Co-authored-by: Sutou Kouhei kou@cozmixng.org
https://github.com/ruby/fiddle/commit/4e3b60c5b6
[ruby/fiddle] Add "offsetof" to Struct classes (https://github.com/ruby/fiddle/pull/83)
I need to get the offset of a member inside a struct without allocating
the struct. This patch adds an "offsetof" class method to structs that
are generated.
The usage is like this:
Co-authored-by: Sutou Kouhei kou@cozmixng.org
https://github.com/ruby/fiddle/commit/4e3b60c5b6
Co-authored-by: Sutou Kouhei kou@cozmixng.org