caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Matthieu Wipliez <mwipliez@yahoo.fr>
To: Robert Fischer <robert.fischer@smokejumperit.com>,
	caml-list <caml-list@yquem.inria.fr>
Subject: Re : [Caml-list] file_desc
Date: Tue, 1 Jul 2008 14:56:31 +0000 (GMT)	[thread overview]
Message-ID: <976118.10326.qm@web27004.mail.ukl.yahoo.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1503 bytes --]

----- Message d'origine ----
> De : Robert Fischer <robert.fischer@smokejumperit.com>
> À : caml-list <caml-list@yquem.inria.fr>
> Envoyé le : Mardi, 1 Juillet 2008, 16h35mn 53s
> Objet : [Caml-list] file_desc
> 
> Is there a way to convert a file_descr to/from an int in OCaml?  The type is 
> abstract, and there
> doesn't seem to be an obvious answer.

It is defined in the Unix module as an int. Perhaps some Obj.magic can do the trick?

For Windows however things are more complicated, because a file_descr is a "struct filedescr" value. It is possible to obtain an int from this using the win_CRT_fd_of_filedescr function or the CRT_fd_val(v) macro, both defined in unixsupport.h.
I think you can either use Obj.field or write a C function (basically calling win_CRT_fd_of_filedescr) to access this information.

> 
> Alternatively, is there a way to get at an inherited file_descr from a process I 
> execv'd into?

However I don't know about that :D

> 
> ~~ Robert.

Matthieu

> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs



      _____________________________________________________________________________ 
Envoyez avec Yahoo! Mail. Une boite mail plus intelligente http://mail.yahoo.fr

[-- Attachment #2: Type: text/html, Size: 1924 bytes --]

                 reply	other threads:[~2008-07-01 14:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=976118.10326.qm@web27004.mail.ukl.yahoo.com \
    --to=mwipliez@yahoo.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=robert.fischer@smokejumperit.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).