Re: XS to return Perl Arrays - and NetWare Select()
[email protected] (Torsten Schoenfeld)
| Newsgroups | perl.xs |
|---|---|
| Message-ID | <[email protected]> |
On 10.06.2011 00:15, NormW wrote: >> AV *results; >> results = newAV(); >> .... >> something = (AV *)SvRV(*other_av_thing); >> .... >> av_store(results,i, something); >> .... >> RETVAL = results; >> sv_2mortal((SV *)RETVAL); > Have seen that method in several XS programs (and PerlXSTut iirc) but it > is unclear if that works when 3 elements are to be returned; will have a > closer look at the Perl XS docs... In short: create the AVs like above, then use newRV_noinc to create array references and push these onto the stack with XPUSHs. Use sv_2mortal only on the array references.