in reply to Passing a bytestring from Perl to Inline::C as a 2d array

You cannot cast a 1D array of integers (as produced by pack), to a 2D array of pointers to arrays of integers. You need to do the index calculations yourself (untested):

void c_function( char *bytes, int rows, int cols ) { int *table = (int *)bytes; int i, j; for ( j = 0; j < cols, ++j ) { for ( i = 0; j < rows; ++i ) { ++table[ j * rows + i ]; } } }

Also, please use <code> ... </code> tags not <pre> ... </pre> tags


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP PCW It is as I've been saying!(Audio until 20090817)