
On 9/26/06, Matthew Bromberg
I am having some difficulty with creating a dynamic link library using GHC on windows XP.
I am attempting to follow the example in http://www.haskell.org/ghc/docs/6.4/html/users_guide/win32-dlls.html
though I have a binary build of ghc 6.5
My problem (I think) is that some of my Haskell source files link to an external C library also contained in a DLL.
I generate my Haskell object files when I compile my Haskell executable. I then attempt to use the object files in a ghc compiler statement like this,
ghc --mk-dll -o netsim.dll ExternLib.o ExternLib_stub.o dllNet.o src1.o src1_stub.o src2.o -optl-lmatrixstack -optl-L"."
My external C library is in matrixstack.dll and it has a corresponding static link stub library matrixstack.lib in the same directory as all the sources. It has references in one of the sources (say src1.hs).
Unfortunately I get a host of undefined references to basically all the functions in matrixstack.dll and also some undefined references of the form Parsefile.o:ghc2996_0.hc:(.text+0x130): undefined reference to `TextziParserCombinatorsziParsecziError_show_closure' Parsefile.o:ghc2996_0.hc:(.text+0x220): undefined reference to `TextziParserCombinatorsziParsecziChar_spaces_closure' Parsefile.o:ghc2996_0.hc:(.text+0x24a): undefined reference to `TextziParserCombinatorsziParsecziChar_spaces_closure' Parsefile.o:ghc2996_0.hc:(.text+0x29c): undefined reference to `TextziParserCombinatorsziParsecziChar_spaces_closure' ...
If you use cabal I think can follow an example I put on the wiki to get these undefined references to go away: http://www.haskell.org/haskellwiki/Cabal Jason