Linker errors when using FFI on Windows

Bayley, Alistair Alistair_Bayley at ldn.invesco.com
Thu Apr 28 09:48:30 EDT 2005


That did it, thanks. Instead of using ghc's -L/-l flags, I used: -optl
c:\windows\system32\ntwdblib.dll

> -----Original Message-----
> From: Sigbjorn Finne [mailto:sof at galois.com] 
> Sent: 28 April 2005 01:04
> To: Bayley, Alistair
> Cc: glasgow-haskell-users at haskell.org
> Subject: Re: Linker errors when using FFI on Windows
> 
> 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 at ldn.invesco.com>
> To: <glasgow-haskell-users at 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 at 4'
> >
> >
> > Thanks,
> > Alistair.
> >
> >

-----------------------------------------
*****************************************************************
Confidentiality Note: The information contained in this   message, and any
attachments, may contain confidential   and/or privileged material. It is
intended solely for the   person(s) or entity to which it is addressed. Any
review,   retransmission, dissemination, or taking of any action in
reliance upon this information by persons or entities other   than the
intended recipient(s) is prohibited. If you received  this in error, please
contact the sender and delete the   material from any computer.
*****************************************************************



More information about the Glasgow-haskell-users mailing list