G/Morning
On 10/06/2011 4:20 PM, Torsten Schoenfeld wrote:
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.
Thanks for the tip! Well make it my next method to try if the one now working on lays an egg.

Decided to examine what was needed on the Perl end of the XS function and after some doodling came up with:

my @ri = array of socket handles (similar to select.pm)

$n = nw_select(\@ri,\@wi,\@ei,$wait);

@ri;

I found some XS code that directly modifies an array(s) passed in as a parm, and doing this means it isn't necessary to return arrays via the stack, and can use RETVAL to return $nfound, which makes this a whole lot simpler problem... (assuming NetWare stays happy).

Will advise this list on progress.

Thanks to all for all the help provided,
Cheers,
Norm

Reply via email to