Hi, The code: use warnings; use Inline C => Config => BUILD_NOISY => 1;
use Inline C => <<'EOC'; SV * array_init(SV * elements) { unsigned long * array, scalar = (unsigned long)SvUV(elements), i; SV * obj_ref, * obj; New(1, array, scalar, unsigned long); if(array == NULL) croak("Failed to allocate memory in array_init function"); obj_ref = newSViv(0); obj = newSVrv(obj_ref, NULL); // Fill the array with some values: for(i = 0; i < scalar; ++i) array[i] = (i + 1) * scalar; sv_setiv(obj, (IV)array); SvREADONLY_on(obj); return obj_ref; } void array_print(SV * obj, SV * elements) { unsigned long i, scalar = (unsigned long)SvUV(elements); for(i = 0; i < scalar; ++i) printf("%u ", ((unsigned long *) SvIV(SvRV(obj)))[i]); printf("\n"); } void destroy(SV * p) { printf("destroy()ing."); Safefree((unsigned long *) SvIV(SvRV(p))); printf("...destroy()ed\n"); } EOC $size = 17; $z1 = array_init($size); $z2 = array_init($size + 3); array_print($z1, $size); array_print($z2, $size + 3); # Clean up: destroy($z2); destroy($z1); __END__ 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) ? Cheers, Rob