
#11072: Runtime linker doesn't search for DLLs referenced in import libraries on Windows -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Phyx- Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2-rc2 (Linking) | Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Matt): @Phyx- I have never before submitted a patch for GHC so i have no idea if i would be able to take over this ticket and what would be proper procedure for going with it. However i have been working on this for few days here is what i got so far. After examining many import libraries i found out that in all import libraries i got my hands on, DLL name was always stored in first object file in import library archive in raw data associated with {{{idata$7}}} section. Based on that i think this is reliable way to implement this. I put together small patch for GHC, however its for GHC-7.10.2 as i have some trouble building and running GHC-head on my PC. In spite of that it should be trivial to port this to head as it changes only few lines of existing code. I would love to hear some input on this and whether this seems viable. In the meantime if I manage to build and test this with GHC-head I will post more update. At the moment with this patch when you invoke GHCi, for example as {{{ghci -lfoo}}}, it will look for {{{libfoo.dll.a}}} and {{{libfoo.a}}} before trying to load libfoo.a as static library. If either of those 2 are found it will try to extract DLL name from them in that order. If this succeds and assuming DLL name fetched was {{{libfoo-1.dll}}}, it will then try to load {{{libfoo-1.dll}}} instead trying to load {{{libfoo.a}}} as static archive. GHCi will also print some trace info when invoked with {{{-v}}} so that in case of trouble it can be traced back from where did DLL name came from. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11072#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler