Adding the -Lc:\windows\system32 option when linking upsets the resolution of misc standard libraries, causing 'ld' to use the DLLs rather than the mingw link libraries, including msvcrt.dll. Try just using c:/windows/system32/ntwdblib.dll on the link line instead. If ld's DLL auto-import support doesn't quite work, attempting to link with the import library 'ntwdblib' (ntwdblib.lib ?) instead is worth a shot. The SQL Server SDK ought to include that somewhere. hth --sigbjorn ----- Original Message ----- From: "Bayley, Alistair" <Alistair_Bayley@ldn.invesco.com> To: <glasgow-haskell-users@haskell.org> Sent: Wednesday, April 27, 2005 08:10 Subject: Linker errors when using FFI on Windows
I'm trying to link an FFI program against a Windows (XP) DLL (c:\windows\system32\ntwdblib - this is the MS Sql Server client library). The output from ghc6.4 -v is below; the errors start in the Linker section.
Comments:
- Where do these objects d0000xx.o come from? (They're not in my source...)
d000013.o(.text+0x0): multiple definition of `_onexit' c:/ghc/ghc-6.4/gcc-lib/crt2.o(.text+0x2a0):crt1.c: first defined here d000018.o(.text+0x0): multiple definition of `atexit' c:/ghc/ghc-6.4/gcc-lib/crt2.o(.text+0x280):crt1.c: first defined here
- Have I omitted some important linker flag? There are tons of these undefined references from crt2.o, like this:
c:/ghc/ghc-6.4/gcc-lib/crt2.o(.text+0x238):crt1.c: undefined reference to `ExitProcess@4'
Thanks, Alistair.