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) set

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 typ

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

2011-06-10 Thread michael
Take a look on CPAN at the C + macros code as well as the XS code in Net::Interface in the xs module. Look at places that use PUSH or XPUSH that return a variety of references. hv's, av's, etc... examples of each type and their manipulation can be found in both the xs and C modules found in the

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

2011-06-10 Thread NormW
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 pr

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

2011-06-09 Thread Torsten Schoenfeld
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

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 (and

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

2011-06-09 Thread NormW
G/Morning, On 10/06/2011 2:46 AM, Brandon McCaig wrote: On Wed, Jun 8, 2011 at 7:11 PM, NormW wrote: AFAICT, I want to implement the following Perl call to XS code: my (@ro,@wo,@eo) = nw_select(\@ri,\@wi,\@ei,$wait); Perhaps you meant: my ($ro, $wo, $eo) = nw_select(\@ri, \@wi, \@ei, $wait)

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

2011-06-09 Thread Josh Goldberg
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); On Wed, Jun 8, 2011 at 4:11 PM, NormW wrote: > Hi All, > AFAICT, I want to implement the following Perl

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

2011-06-09 Thread Brandon McCaig
On Wed, Jun 8, 2011 at 7:11 PM, NormW wrote: > AFAICT, I want to implement the following Perl call to XS code: > > my (@ro,@wo,@eo) = nw_select(\@ri,\@wi,\@ei,$wait); Perhaps you meant: my ($ro, $wo, $eo) = nw_select(\@ri, \@wi, \@ei, $wait); That is, instead of getting three arrays returned, g