[Haskell-cafe] Creating DLLs with GHC

Esa Ilari Vuokko eivuokko at gmail.com
Wed Sep 27 03:18:00 EDT 2006


On 9/27/06, Matthew Bromberg <mattcbro at earthlink.net> wrote:
> though I have a binary build of ghc 6.5

If you have new ghc 6.5, you can use --mk-dll with --make, in case that helps.

> 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).

If I recall correctly, to link Ms-style import libs, you must specify
them as object
files (ie no -optl-lfoo, but just foo.lib) or make mingw-style import
libs via .def
files.  But as you've not run into this yet, maybe it works for you like that.

> 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'

-package parsec
to you ghc commandline.  And similary for any other packages you used while


More information about the Haskell-Cafe mailing list