On Mon, Jun 20, 2005 at 08:35:55PM +1000, Sisyphus wrote: > The Inline C function 'array_print()' prints out the values "contained" in > the 2 objects. > How do I get direct access to those values "contained" in $z1 and $z2 using > perl (as opposed to the Inline C 'array_print()' function) ?
Not really an Inline question :-) use Config; sub pp_array_print { my $self = shift; my $size = shift; my $address = $$self; # Caution. 1: Get the address wrong and this will segv # "L!" isn't guaranteed to be the same size as a pointer. This will end # up being platform specific my $array = unpack "P" . ($Config{longsize} * $size), pack "L!", $address; foreach (unpack "L!*", $array) { printf "%u ", $_; } print "\n"; } pp_array_print($z1, $size); There might be slightly cleaner ways to work out the pack templates. Nicholas Clark