|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
file_descIs 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. Alternatively, is there a way to get at an inherited file_descr from a process I execv'd into? ~~ Robert. _______________________________________________ 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 |
|
|
Re: file_descRobert Fischer wrote:
> 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. > > Alternatively, is there a way to get at an inherited file_descr from a process I execv'd into? > > ~~ Robert. > > _______________________________________________ > 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 > > _______________________________________________ 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 |
|
|
Re: file_descOn Tue, Jul 01, 2008 at 09:35:53AM -0500, Robert Fischer wrote:
> 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. > > Alternatively, is there a way to get at an inherited file_descr from a > process I execv'd into? Not in the default standard library, I don't think. Jane Street's core library <http://ocaml.janestcapital.com/?q=node/13> contains such a function, however. It is implemented as: external file_descr_of_int : int -> file_descr = "%identity" Another approach is to write something like: let file_descr_of_int fd = assert (fd >= 0); assert (Obj.is_int (Obj.repr Unix.stdin)); ((Obj.magic fd) : Unix.file_descr) Mark _______________________________________________ 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 |
|
|
Re: file_descRobert Fischer wrote:
> 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. If you don't want to use Obj.magic, there is also the Netsys module from Ocamlnet, which defines these two functions as C extensions: val int_of_file_descr : Unix.file_descr -> int val file_descr_of_int : int -> Unix.file_descr Dave _______________________________________________ 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 |
| Free Forum Powered by Nabble | Forum Help |