# Windows

(Difference between revisions)

## Revision as of 20:56, 6 December 2009

GHC is well supported on Windows.

## 3 Tools for compilation

• As some of the packages contain Unix/Linux specific scripts/commands, you need MinGW and MSYS to simulate a Unix environment. In some cases you need Cygwin instead. If you use msysgit on Windows already, all you need to do is add MinGW to your path.
• If you need to link to C-software, define an environment variable C_INCLUDE_PATH that lists the directories where the header files can be found. For linking the libraries you need to define an environment variable LIBRARY_PATH as well, listing the directories where .a and .lib files can be found.
• Source files from Unix(-like) systems have lines terminated with Line Feed only; to convert them to MS-DOS format (as needed by Windows), use the `unix2dos` command (included in MSYS). For more information, give command: `unix2dos --help`
• To convert a set of files to MS-DOS format (note: this might damage binary files):
`C:\MSYS\1.0\bin\find . -type f -exec unix2dos {} ;`
Note: the `find` command included in MSYS is different from the MS-DOS `find` command, therefore, you need to specify the entire path to this command.

## 4 Libraries

• GUI : Gtk2Hs - A binding of GTK in Haskell. Note this requires installing GTK on windows.
• Win32 - low levelish bindings to Windows API. Comes with ghc and non-minimal hugs distribution. Win32 darcs repo
• winerror: Error handling for foreign calls to the Windows API

## 5 Special tips and tricks for Windows

• GHCi: Using GHCi from a DOS box sucks. Using it from withing shell mode in Emacs sucks a lot less - do 'M-x shell' in emacs, then type 'ghci'.
• GHCi on Cygwin: When running GHC under a Cygwin shell on Windows, Ctrl-C sometimes doesn't work. A workaround is to use the rlwrap program to invoke ghci : In addition to proper Ctrl-C, you also get emacs (or vi) key bindings and command history across sessions, which saves you a load of typing.
• If a package depends (either directly or indirectly) on the `unix` package, you cannot compile it on Windows

```* bamse lets you build windows installers for your Haskell app (MSI).