[Haskell-cafe] Creating DLLs with GHC

SevenThunders mattcbro at earthlink.net
Wed Sep 27 18:37:12 EDT 2006

SevenThunders wrote:
> 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'
> ...
> This appears to be coming from unsatisfied references to 
> Text.ParserCombinators.Parsec, which I thought was a standard library.  
> I note that my stand alone haskell executable links just fine and runs 
> perfectly.
> What am I missing to make this work?
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

I have solved one issue here.  Apparently my matrixstack.lib was corrupted. 
I am not sure how this happened. Recompiling this library seems to have
resolved the problem concerning undefined links.  Sorry for the diversion
and I do appreciate the help offered.
View this message in context: http://www.nabble.com/Creating-DLLs-with-GHC-tf2342692.html#a6536255
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

More information about the Haskell-Cafe mailing list