From: Olivier Andrieu <andrieu@ijm.jussieu.fr>
To: "Jeremy Fincher" <tweedgeezer@hotmail.com>
Cc: <caml-list@pauillac.inria.fr>
Subject: Re: [Caml-list] getting fd behind a channel from C
Date: Tue, 4 Sep 2001 10:30:02 +0200 [thread overview]
Message-ID: <15252.37130.686271.39272@akasha.ijm.jussieu.fr> (raw)
In-Reply-To: <DAV47FrGygngW5Z8cEw0000167d@hotmail.com>
Jeremy Fincher [Tuesday 4 September 2001] :
>
> I can't for the life of me figure out how, from C, to take an in_channel and
> get the file descriptor of it. How do I write a C function that takes an
> in_channel and then does some work on the underlying file descriptor?
in the OCaml source tree, look at byterun/io.h : it contains
definitions and macros to access caml channels from C :
- struct channel has a field fd for the file descriptor.
- the macro Channel takes a Caml value and gives you a struct
channel*
so (Channel(ml_channel))->fd does what you want.
There's also the Unix.descr_of_in_channel and
Unix.descr_of_out_channel functions.
Olivier
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
next prev parent reply other threads:[~2001-09-04 8:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-04 6:23 Jeremy Fincher
2001-09-04 8:30 ` Olivier Andrieu [this message]
2001-09-04 14:37 ` Jeremy Fincher
2001-09-04 15:08 ` Olivier Andrieu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=15252.37130.686271.39272@akasha.ijm.jussieu.fr \
--to=andrieu@ijm.jussieu.fr \
--cc=caml-list@pauillac.inria.fr \
--cc=tweedgeezer@hotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).