return sbv.getStructClass().newInstance(runtime.getCurrentContext(),
new IRubyObject[] { new Pointer(runtime, memory) },
Block.NULL_BLOCK);
} else if (type instanceof MappedType) {
MappedType mappedType = (MappedType) type;
return mappedType.fromNative(runtime.getCurrentContext(), fromNative(runtime, mappedType.getRealType(), buffer, index));
} else {
throw runtime.newTypeError("unsupported callback parameter type: " + type);
}