Method: FFI::StructLayout::Array#get

Defined in:
ext/ffi_c/StructLayout.c

#get(pointer) ⇒ FFI::StructLayout::CharArray, FFI::Struct::InlineArray

Get an array from a Type::Struct.

Parameters:

Returns:



357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
# File 'ext/ffi_c/StructLayout.c', line 357

static VALUE
array_field_get(VALUE self, VALUE pointer)
{
    StructField* f;
    ArrayType* array;
    VALUE argv[2];

    TypedData_Get_Struct(self, StructField, &rbffi_struct_field_data_type, f);
    TypedData_Get_Struct(f->rbType, ArrayType, &rbffi_array_type_data_type, array);

    argv[0] = pointer;
    argv[1] = self;

    return rb_class_new_instance(2, argv, isCharArray(array)
            ? rbffi_StructLayoutCharArrayClass : rbffi_StructInlineArrayClass);
}