develooper Front page | perl.perl5.porters | Postings from May 2016

How to use I/O from extension modules ?

Thread Next
Timothy Madden
May 12, 2016 20:43
How to use I/O from extension modules ?
Message ID:

I am trying to write an extension module with native C code, and I have a
couple of questions:

   - My class has an entry with an open device handle. How can my C code
get the file description (fd) for this handle please ? I can see sv_2io()
in perlapi, but there is no documentation about what do to next with the
resulting IO * value. I ended up calling the perl fileno() from my C code,
and I would like to know if there is a better / straigthforward way ?

   - To my surprise I noticed system calls for read() / ioctl() /.. are
overriden by <perl.h> with a macro. Should I worry about this ? Can I find
some more information ? I would like to use these calls in my extension and
I would like to know if I should try to avoid the re-definition, maybe with
a separate .c file that still exports the original function pointers.

Thank you,
Timothy Madden

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About