in reply to Re^4: perl XS - passing array to C and getting it back
in thread perl XS - passing array to C and getting it back

The easy approach is to install and use Inline::C to generate the XS scaffolding for your code. After that, you throw away Inline::C and only use its output.

If you don't know how to install Inline::C, the easy approach is outlined in the following steps:

  1. Install local::lib (because you don't want to pollute the system Perl)
  2. Set your environment variables like local::lib proposes
  3. Download cpanm from http://cpanmin.us
  4. Run the following command:
    cpanm Inline::C

You now have Inline::C and its prerequisites installed in a local directory and can use Inline::C to generate much of the XS code for you.