Ticket #4465 (closed bug: fixed)
GHCi linker failure on Windows
| Reported by: | joellathrop | Owned by: | simonmar |
|---|---|---|---|
| Priority: | high | Milestone: | 7.4.1 |
| Component: | GHCi | Version: | 6.12.3 |
| Keywords: | ghci linker -L DLL | Cc: | joell@…, overture2112@…, fryguybob@… |
| Operating System: | Windows | Architecture: | x86 |
| Type of failure: | Incorrect result at runtime | Difficulty: | Unknown |
| Test Case: | ghci/linking/ghcilink002 | Blocked By: | |
| Blocking: | Related Tickets: |
Description
On Windows, GHCi seems unable to find a DLL in a non-standard location, even when that location is provided with -L.
Presume a valid DLL named "foo.dll" in "c:\temp\test". An attempt to load "foo" into GHCi when the current working directory is "c:\temp\test" is successful:
C:\temp\test>ghci -lfoo GHCi, version 6.12.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. Loading object (dynamic) foo ... done final link ... done Prelude>
However, if the current working directory is "c:\temp" all attempts to load "foo" into GHCi using the -L switch fail:
C:\temp>ghci -lfoo -Ltest GHCi, version 6.12.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. : foo: The specified module could not be found. Loading object (dynamic) foo ... failed. <command line>: user specified .o/.so/.DLL could not be loaded (addDLL: could no t load DLL) Whilst trying to load: (dynamic) foo Additional directories searched: test
C:\temp>ghci -lfoo -L\temp\test GHCi, version 6.12.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. : foo: The specified module could not be found. Loading object (dynamic) foo ... failed. <command line>: user specified .o/.so/.DLL could not be loaded (addDLL: could no t load DLL) Whilst trying to load: (dynamic) foo Additional directories searched: \temp\test
C:\temp>ghci -lfoo -Lc:\temp\test GHCi, version 6.12.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. : foo: The specified module could not be found. Loading object (dynamic) foo ... failed. <command line>: user specified .o/.so/.DLL could not be loaded (addDLL: could no t load DLL) Whilst trying to load: (dynamic) foo Additional directories searched: c:\temp\test
However, GHCi has no problem loading "foo" if the path component is included in the -l option. (Naturally, this is not ideal and far from the accepted usage of -l and -L.)
C:\temp>ghci -ltest\foo GHCi, version 6.12.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package ffi-1.0 ... linking ... done. Loading object (dynamic) test\foo ... done final link ... done Prelude>
Finally, this issue does not manifest on Linux. Everything seems to work fine there.
