Windows overlapped IO

Felix Martini fmartini at
Thu Nov 22 08:32:22 EST 2007

Hi all,

Overlapped IO support for files and sockets is now in place in my test
version of ghc-head. File functions use the win32 api and large files
and Unicode filenames are supported (i'm not sure if ghc currently
supports that for Windows).

I've addded a new type Hdl which is an alias for FD on non-Windows
systems and WinHdl on Windows. That way many functions in GHC.Handle
can remain generic. WinHdl is similar to the WinHandle type in Simon's

I do have a bug where i can't locate the problem. GHCi works fine
after limited testing, but when compiling a trivial program with GHC i
get the following during the linking stage:

ghc: fd:1880: lazyRead: invalid argument (Bad file descriptor)
ghc: fd:1888: lazyRead: invalid argument (Bad file descriptor)

After googling for similar bug reports it seems that it has to do with
standard handles and the finalizer. But the code for standard handles
and consoles is largely untouched. Also some advice on the best way to
debug things like this would be welcome because compiling the complete
GHC is rather slow on my single processor pc.


More information about the Glasgow-haskell-users mailing list