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

Re: How to use I/O from extension modules ?

Thread Previous
From:
Leon Timmermans
Date:
May 12, 2016 21:34
Subject:
Re: How to use I/O from extension modules ?
Message ID:
CAHhgV8jt50Z3acjZA3fWee0oO+fxZMnNvk4c7mYVOi+-6U+now@mail.gmail.com
On Thu, May 12, 2016 at 10:43 PM, Timothy Madden <terminatorul@gmail.com>
wrote:

>    - 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 ?
>

You can use something like: PerlIO_fileno(IoIFP(sv_2io(value)));


>    - 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.
>

AFAIK this only happens on Windows (or actually, IMPLICIT_SYS systems), and
can be disabled by defining NO_XSLOCKS.

Leon

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About