In C a parameter of
unsigned char c[MAX_LEN1][MAX_LEN2]
is mis-leading, because the
first dimension of an array (MAX_LEN1) is ignored at the calling interface, only the second has any meaning. Having said that though, it appears that XS will not accept a multi-dimension array, so use something like this:
#define MAX_LEN2 1024
int function1(a,b,p)
int a
unsigned short b
unsigned char *p
CODE:
unsigned char (*c)[MAX_LEN2] = (unsigned char (*)[MAX_LEN2])p;
OUTPUT:
RETVAL
Update: I notice that you have added a question 2. I can't answer that, but you should consider just what a "multi-dimensional array" is. Pedantically neither C nor Perl support that: C uses an array of pointers and Perl an array of references. To keep it simple you might consider breaking it down first into an array and then the type of each element (a pointer or a reference).
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.