summaryrefslogtreecommitdiff
path: root/compiler/ghci/Linker.lhs
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2008-09-03 10:49:51 +0000
committerSimon Marlow <marlowsd@gmail.com>2008-09-03 10:49:51 +0000
commitb9110541efb85f9489b1f9a0c95445419e61d86d (patch)
tree1e01111460edc9c11b8f5a833ac048457dc4e279 /compiler/ghci/Linker.lhs
parent5cb8bd3a80ce9a53e78d9f9773a4cf7797fefcf2 (diff)
downloadhaskell-b9110541efb85f9489b1f9a0c95445419e61d86d.tar.gz
Windows: print an error message in addDLL
Also, look for libXXX.dll in addition to XXX.dll (see #1883, this isn't really a proper fix, but it'll help in some cases). And I tidied up the error message for a DLL load failure, though it's still a bit of a mess because addDLL is supposed to return a (static) string with the error message, but this isn't possible on Windows.
Diffstat (limited to 'compiler/ghci/Linker.lhs')
-rw-r--r--compiler/ghci/Linker.lhs17
1 files changed, 8 insertions, 9 deletions
diff --git a/compiler/ghci/Linker.lhs b/compiler/ghci/Linker.lhs
index 459fbd9e90..5d01b9a71f 100644
--- a/compiler/ghci/Linker.lhs
+++ b/compiler/ghci/Linker.lhs
@@ -456,21 +456,20 @@ preloadLib dflags lib_paths framework_paths lib_spec
where
preloadFailed :: String -> [String] -> LibrarySpec -> IO ()
preloadFailed sys_errmsg paths spec
- = do maybePutStr dflags
- ("failed.\nDynamic linker error message was:\n "
- ++ sys_errmsg ++ "\nWhilst trying to load: "
- ++ showLS spec ++ "\nDirectories to search are:\n"
- ++ unlines (map (" "++) paths) )
- give_up
+ = do maybePutStr dflags "failed.\n"
+ ghcError $
+ CmdLineError (
+ "user specified .o/.so/.DLL could not be loaded ("
+ ++ sys_errmsg ++ ")\nWhilst trying to load: "
+ ++ showLS spec ++ "\nAdditional directories searched:"
+ ++ (if null paths then " (none)" else
+ (concat (intersperse "\n" (map (" "++) paths)))))
-- Not interested in the paths in the static case.
preload_static _paths name
= do b <- doesFileExist name
if not b then return False
else loadObj name >> return True
-
- give_up = ghcError $
- CmdLineError "user specified .o/.so/.DLL could not be loaded."
\end{code}