#4465: GHCi linker failure on Windows
-----------------------------------+----------------------------------------
    Reporter:  joellathrop         |        Owner:                             
        Type:  bug                 |       Status:  new                        
    Priority:  normal              |    Milestone:  7.2.1                      
   Component:  GHCi                |      Version:  6.12.3                     
    Keywords:  ghci linker -L DLL  |     Testcase:                             
   Blockedby:                      |   Difficulty:                             
          Os:  Windows             |     Blocking:                             
Architecture:  x86                 |      Failure:  Incorrect result at runtime
-----------------------------------+----------------------------------------
Changes (by fryguybob):

 * cc: fryguybob@… (added)


Comment:

 I poked around on this a little and found that loadDynamic in
 compiler\ghci\Linker.lhs doesn't try to append an extension because addDll
 (from job rts\Linker.c) does that job.  But if you don't add the extension
 it isn't going to find the file.

 {{{
 #!hs
 -- return Nothing == success, else Just error message from dlopen
 loadDynamic :: [FilePath] -> FilePath -> IO (Maybe String)
 loadDynamic paths rootname
   = do  { mb_dll <- findFile mk_dll_path paths
         ; case mb_dll of
             Just dll -> loadDLL dll
             Nothing  -> loadDLL (mkSOName rootname) }
                         -- Tried all our known library paths, so let
                         -- dlopen() search its own builtin paths now.
   where
     mk_dll_path dir = dir </> mkSOName rootname

 mkSOName :: FilePath -> FilePath
 mkSOName root
  | isDarwinTarget  = ("lib" ++ root) <.> "dylib"
  | isWindowsTarget = -- Win32 DLLs have no .dll extension here, because
                      -- addDLL tries both foo.dll and foo.drv
                      root
  | otherwise       = ("lib" ++ root) <.> "so"
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4465#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to