[GHC] #7097: linker fails to load package with binding to foreign library
GHC
cvs-ghc at haskell.org
Tue Jul 31 02:49:16 CEST 2012
#7097: linker fails to load package with binding to foreign library
--------------------------+-------------------------------------------------
Reporter: nus | Owner:
Type: bug | Status: new
Priority: normal | Component: Runtime System
Version: 7.4.2 | Keywords:
Os: Windows | Architecture: x86
Failure: None/Unknown | Testcase:
Blockedby: | Blocking:
Related: 2283 |
--------------------------+-------------------------------------------------
Changes (by nus):
* related: => 2283
Comment:
`WSACleanup` is declared `__declspec(dllimport)` in the MinGW CRT headers.
That makes the object file to refer to `__imp__WSACleanup at 0`, to be
resolved through a stub library of MinGW named `libws2_32.a`. `ws2_32` is
mentioned in the `extra-libraries` field of the `network` package entry in
the ghc package configuration database, so `-lws2_32` is added to the
linker command arguments. From the linker documentation:
{{{
For instance, when ld is called with the argument `-lxxx' it will
attempt to find, in the first directory of its search path,
libxxx.dll.a
xxx.dll.a
libxxx.a
xxx.lib
cygxxx.dll (*)
libxxx.dll
xxx.dll
before moving on to the next directory in the search path.
}}}
So the linker finds `libws2_32.a` in one of the search paths passed on on
the command line (through the built-in gcc specs, cf.
`link_gcc_c_sequence`).
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7097#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list