summaryrefslogtreecommitdiff
path: root/ext/ffi_c/Call.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/ffi_c/Call.c')
-rw-r--r--ext/ffi_c/Call.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/ffi_c/Call.c b/ext/ffi_c/Call.c
index bd6c277..8aa8696 100644
--- a/ext/ffi_c/Call.c
+++ b/ext/ffi_c/Call.c
@@ -424,7 +424,9 @@ getPointer(VALUE value, int type)
} else if (type == T_DATA && rb_obj_is_kind_of(value, rbffi_StructClass)) {
- AbstractMemory* memory = ((Struct *) DATA_PTR(value))->pointer;
+ Struct* s;
+ TypedData_Get_Struct(value, Struct, &rbffi_struct_data_type, s);
+ AbstractMemory* memory = s->pointer;
return memory != NULL ? memory->address : NULL;
} else if (type == T_STRING) {