Class: FFI::StructLayout::StructByValue

Inherits:
Field
  • Object
show all
Defined in:
ext/ffi_c/StructLayout.c

Instance Method Summary collapse

Methods inherited from Field

#alignment, #ffi_type, #initialize, #name, #offset, #put, #size

Constructor Details

This class inherits a constructor from FFI::StructLayout::Field

Instance Method Details

#get(pointer) ⇒ Object



257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'ext/ffi_c/StructLayout.c', line 257

static VALUE
inline_struct_field_get(VALUE self, VALUE pointer)
{
    StructField* f;
    StructByValue* sbv;
    VALUE rbPointer = Qnil, rbOffset = Qnil;

    Data_Get_Struct(self, StructField, f);
    Data_Get_Struct(f->rbType, StructByValue, sbv);

    rbOffset = UINT2NUM(f->offset);
    rbPointer = rb_funcall2(pointer, rb_intern("+"), 1, &rbOffset);

    return rb_class_new_instance(1, &rbPointer, sbv->rbStructClass);
}