in reply to Linking Open Perl Filehandles to Stream Based C code via XS

I've had luck with something along the lines of:
XS(XS_widget) { dXSARGS; FILE* in = PerlIO_findFILE(IoIFP(sv_2io(ST(0)))); FILE* out = PerlIO_findFILE(IoIFP(sv_2io(ST(1)))); /* copy in to out */ }
Obviously you'd want to do stuff like error handling and arg counts and stuff, but that's basically how xsubpp handles XSUB definitions like the following in .xs files:
char* read(fd,count) FILE* fd int count CODE: ...
c.

Replies are listed 'Best First'.
Re^2: Linking Open Perl Filehandles to Stream Based C code via XS
by tachyon (Chancellor) on Nov 06, 2004 at 22:31 UTC

    Thanks very much, that's just what I was after.

    cheers

    tachyon