caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re : [Caml-list] file_desc
@ 2008-07-01 14:56 Matthieu Wipliez
  0 siblings, 0 replies; only message in thread
From: Matthieu Wipliez @ 2008-07-01 14:56 UTC (permalink / raw)
  To: Robert Fischer, caml-list

[-- 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 --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-07-01 14:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-01 14:56 Re : [Caml-list] file_desc Matthieu Wipliez

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