2
votes

I was following the guide for making DLL's to be called from other languages here:

http://www.haskell.org/ghc/docs/7.0.4/html/users_guide/win32-dlls.html

I first compile the Haskell module and the helper C file like so:

ghc -c SanitizeXSS.hs

ghc -c StartEnd.c

But when I try to link it all together like so:

ghc -shared -o SanitizeXSS.dll SanitizeXSS IdsSanitizeXSS_stub.o StartEnd.o

I get lots of error messages like this:

SanitizeXSS.o:fake<.data+0760>: undefined reference to 'textzm0zi11zi1zi5_DataziText_zdf0rdText_closure'

SanitizeXSS.o an object file that was auto-generated when I compiled the Haskell module.

I've tried the -no-hs-main trick mentioned in other threads.

Context: I'm trying to use the FFI to export a Haskell function that I will then hopefully call in a Managed Wrapper in C#.

1
I've been trying to do this as well with no luck. Any success? - Daniel

1 Answers

1
votes

Try passing --make to ghc, so that it will resolve references to missing Haskell libraries. Alternatively, list the Haskell packages you're linking against explicitly.