|
 |
Some while ago, they added a feature to the Haskell compiler where you
can link Haskell libraries dynamically rather than statically.
However, this feature works only on Unix, because Haskell hates Windows.
*sigh*
But wait! What's this? The latest and greatest version of GHC just
released now supports Windows DLLs too. Cool!
...well, partly cool anyway.
Good things:
- Compiling the Hello World program with static libraries gives me a
518KB file, but with dynamic libraries that goes down to 13KB.
Bad things:
- The program doesn't actually /run/ any more. It can't find the
necessary DLLs. It seems that /you/ have to manually copy them to
somewhere sensible and/or alter the search path.
- Finding the DLL files is non-trivial. Rather than putting them all in
one folder, the installer scatters them across the filesystem in a
pseudo-random manner. (This is quite probably why the DLL loader can't
find them either.)
- Hello World requires the DLLs for the Haskell run-time system, Haskell
compiler primitives, foreign function interface, arbitrary-precision
integers, and of course the Haskell "base" library. That's 5 DLLs you
have to have in your search path.
- These five DLLs add up to 8MB. (!)
03/12/2010 03:55 PM 12,814 HelloWorld.exe
13/11/2010 12:16 AM 7,015,961 libHSbase-4.3.0.0-ghc7.0.1.dll
13/11/2010 12:18 AM 35,854 libHSffi-ghc7.0.1.dll
13/11/2010 12:16 AM 676,886 libHSghc-prim-0.2.0.0-ghc7.0.1.dll
13/11/2010 12:16 AM 394,520 libHSinteger-gmp-0.2.0.2-ghc7.0.1.dll
13/11/2010 12:18 AM 266,240 libHSrts-ghc7.0.1.dll
6 File(s) 8,402,275 bytes
And you thought MSVBVM50.DLL was a pain! >_<
(I especially love the way that I'm not actually /using/ FFI or
arbitrary-precision integers, and yet I must have the DLLs installed.
But then, *I* am not using FFI, but the entire Haskell I/O system is
based on it. Similarly, file sizes are returned as arbitrary-precision
integers, so the DLL for that is required.)
In summary, I don't think I'll rush out and use this feature anytime soon.
Also entertaining is the way that several new features of the compiler
aren't accurately reflected in all of the documentation. (E.g., some
chapters claim that shared libraries don't work on Windows, while others
assert that they do...)
PS. I just tried compiling with dynamic libraries using an older version
of the compiler (i.e., one which supports it on Unix but not on
Windows). Rather than saying "sorry, this is not supported on Windows",
or even just "unrecognised flag name", instead it crashes with a
file-not-found error from GCC. Graceful failure, anyone?
Post a reply to this message
|
 |