XS to return Perl Arrays - and NetWare Select()

2011-06-08 Thread NormW
Hi All, AFAICT, I want to implement the following Perl call to XS code: my (@ro,@wo,@eo) = nw_select(\@ri,\@wi,\@ei,$wait); What I think I need is XS code to return the 3 LHS arrays or 'undef's as appropriate. PerlXSTut Sample 7 seems a possible ideas source but alas it is in the 'Coming

Re: XS to return Perl Arrays - and NetWare Select()

2011-06-09 Thread NormW
G/Morning, On 10/06/2011 4:36 AM, Josh Goldberg wrote: What I do is something like 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

Re: AW: XS to return Perl Arrays - and NetWare Select()

2011-06-10 Thread NormW
G/Morning, On 10/06/2011 4:14 PM, Bolhar-Nordenkampf Ferdinand wrote: Perhaps you meant: my ($ro, $wo, $eo) = nw_select(\@ri, \@wi, \@ei, $wait); That were my first thoughts too when I saw this code - a function can return a single list only - and Perl can't know how this list should be

Re: XS to return Perl Arrays - and NetWare Select()

2011-06-11 Thread NormW
G/Morning, On 11/06/2011 10:27 AM, mich...@insulin-pumpers.org wrote: Take a look on CPAN at the C + macros code as well as the XS code in Net::Interface in the xs module. Thanks! Look at places that use PUSH or XPUSH that return a variety of references. hv's, av's, etc... examples of each

Re: XS to return Perl Arrays - and NetWare Select()

2011-06-11 Thread NormW
G/Morning All Lights sometimes come on very slowly. In addition to tweaking XS code to NetWare's select() to work (more anon) (finally) realised that IO::Select::INET was returning was an object and not the socket needed for select() (Doh!). On the the XS problem that began here have (ftm)