Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Linking Open Perl Filehandles to Stream Based C code via XS

by beauregard (Monk)
on Nov 06, 2004 at 20:02 UTC ( [id://405806]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://405806]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-19 03:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found