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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.