fetch#
Read the value of a type at an address.
Synopsis#
my $n = Peta::FFI::fetch($ptr, "i32");
my $xy = Peta::FFI::fetch($ptr, "d[2]"); # [1.5, -2]
my $pt = Peta::FFI::fetch($ptr, "{My::Point}"); # a My::Point copy
What call would return for that type, read from the memory at $addr: the numbers, b, o (0 for NULL), D as a float, cf/cd as [re, im], p - the C string the char * there points to, T[N] as an array reference and {Class} as a record. Reading memory the process does not own is undefined behaviour.