Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: [Caml-list] Unix.file_descr -> int ???
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Damien Doligez <damien.doligez@i...>
Subject: Re: [Caml-list] Unix.file_descr -> int ???
>From: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>

>Windows version:
>
>let dump_handle (h : Unix.file_descr) =
>  let obj = Obj.repr h in
>  if Obj.is_block obj && Obj.tag obj = Obj.custom_tag then
>    Nativeint.format "%x" (Obj.obj obj)
>  else invalid_arg "dump_handle"

This does not work.  You are printing the address of the custom block
that contains the handle, but this address can change during program
execution.

-- Damien
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners