Version française
Home     About     Download     Resources     Contact us    
Browse thread
Anyone ported OCamlTk to Tcl/Tk 8.0 on Windows?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: Anyone ported OCamlTk to Tcl/Tk 8.0 on Windows?
> The proper fix would be to use
> Tcl_CreateChannelHandler (Tcl_MakeFileChannel (some_descriptor))
> where some_descriptor is the file descriptor under Unix, and a HANDLE under
> Windows.
> Unfortunately, I didn't have time to look into the Windows version of
> our libunix library to see what notion of file descriptor/handle we are 
> using there, and if it fits our purpose. You might want to check that
> with Xavier, who is the main perpetrator of this library.
                               ^^^^^^^^^^^
Well, Win32 programming is not a crime; a misdemeanor, perhaps...

At any rate, the Windows version of libunix uses Win32 native HANDLE
to represent the type Unix.file_descriptor.  (Initially, we used
Visual C++'s emulation of Unix file descriptors, but it was too buggy.)
So, it should work with Tcl_MakeFileChannel.

To extract the HANDLE from a Caml value of type Unix.file_descriptor,
just use the following handy macro (found in
otherlibs/win32unix/unixsupport.h):

        #define Handle_val(v) (*((HANDLE *)(v)))

If anyone gets Tk 8.0 to work under Windows, please send us the
patches.

Best regards,

- Xavier Leroy