Win32 dlls -- how to do it?

Andy Serpa
Fri, 27 Jun 2003 13:31:32 -0400


New to Haskell, new to GHC.  My initial intention in picking up Haskell is=
 to be able 
to write some functions in Haskell and then compile them into .dlls for Wi=
n32 that I 
can call from programs written in other languages.  So before I get too de=
invested I want to make sure that is possible.

So I tried following the example in the GHC docs about generating a .dll t=
o be 
called from external programs in another language, but it does not compile=
correctly.  I tried using the *EXACT* files specified in section 11.4.4. o=
f the GHC 
manual.  The Adder module compiles fine (& produces the extra stub), but 
"DllMain.c" gives a (single) warning, and the final step:

ghc =96=96mk-dll -o adder.dll adder.o adder_stub.o dllMain.o

fails with a whole slew of errors.  I'm using GHC 6.0.

Andy Serpa