I think this is due to the lack of support. However, I cannot get a direct answer about whether the GHC supports dynamic binding. The wiki page wiki SharedLibraries / PlatformSupport is two years old.
On Windows, I tried to create a whole bunch of packages with --enable-shared , including a simple program that I wrote that uses http-enumerator to load from the URL every 30 seconds. When I started the program (after placing all the DLLs in the folder with my program), it disappeared for a few seconds. When I compiled with --threaded , it shuts down immediately.
I tried this in GHC 7.0.3. The documentation page for this version says:
Creating Haskell libraries in DLLs does not work on Windows at the moment; we hope to re-install this object in the future (see section 4.12 "Using Shared Libraries") ....
This notification does not appear in later versions.
By the way, there is another problem with static binaries besides code size. The GHC uses GMP for its great, one-piece support. GMP is licensed under the LGPL. This means that if you need to distribute your own file, or if you have a dependency that is not compatible with the GPL (for example, OpenSSL), you will need to distribute your object files under the GMP license. Either that, or find a way to make libgmp dynamically bind. I would like to know how to do this.
source share