in reply to Re: Sending PerlIO* to the stack for call_sv()?
in thread Sending PerlIO* to the stack for call_sv()?

Doesn't work for PerlIO objects. Compiler throws warning of wrong pointer type, and the perl function ends up receiving "undef" in place of where the PerlIO argument should have been.
  • Comment on Re^2: Sending PerlIO* to the stack for call_sv()?

Replies are listed 'Best First'.
Re^3: Sending PerlIO* to the stack for call_sv()?
by creamygoodness (Curate) on Oct 16, 2005 at 16:26 UTC
    A PerlIO* isn't a scalar, so you can't put it on the stack. FYI, to get a PerlIO* from a filehandle created in Perl, you use...

    PerlIO* outstream = IoOFP( sv_2io(out_fh_ref_sv) ); PerlIO* instream = IoIFP( sv_2io(in_fh_ref_sv) );

    Note that IoOFP and IoIFP are not officially blessed in perlapi, but people are using them in CPAN code, and it's the only way to get the job done.

    As for going the other way, what you're doing looks right to me, but I'm not a guru.

    --
    Marvin Humphrey
    Rectangular Research ― http://www.rectangular.com