
GHC 6.4's support for Win32 is definitely broken. However, I've been experimenting with implementing a wrapper using FFI, and that has proven to be reasonably easy. The only gotchas: 1- You have to run ghc --make with the extra -lGdi32, -lUser32, etc... switches. 2- You can't use something like ghc -e:Main.main Main.hs to run Win32 programs. As soon as you are passing function pointers around (WindowProcs and the like) it just won't work because of the stub.c files. 3- Safely managing function pointers can be tricky, because FuncPtr has to be explicitly deallocated or else it will leak. 4- If you don't want to have the console window, you have to add the -optl-mwindows switch to the command line (hopefully, it'll be documented at some point) and refrain from ever writing anything out to stdout or stderr. If you want to be able to write stuff out (so that you can see it by ommitting the switch) then do something like this: ---8<--------------------------- initGUI = catch (putStr " \b" >> hFlush stdout) $ \_ -> do fd <- open "nul" 2 0 dup2 fd 0 dup2 fd 1 dup2 fd 2 return () open fname oflag pmode = withCString fname $ \c_fname -> c_open c_fname oflag pmode foreign import ccall unsafe "HsBase.h __hscore_open" c_open :: CString -> CInt -> CInt -> IO CInt foreign import ccall unsafe "HsBase.h dup2" dup2 :: CInt -> CInt -> IO CInt ---8<--------------------------- and then call initGUI from your main. All very platform/compiler dependent, of course, so use with good judgement. JCAB Neil Mitchell wrote:
Hi,
The CVS version of Hugs for Windows has a module System.Win32.Registry, along with quite a few other windows modules.
I'm not sure if the last stable releases have these features in or not.
Thanks
Neil
On 9/11/05, Brian McQueen
wrote: How can I use Haskell to do general Windows programming, like you would be able to do if you were using one of those Windows IDEs:
*moving data between windows apps *gaining access to windows registry *in general, access to the available Windows APIs
I'm sure folks must be writing Windows apps in Haskell somewhere. How do I get started?
Brian McQueen _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe