From: panne Date: Sat, 22 May 2004 12:27:38 +0000 (+0000) Subject: [project @ 2004-05-22 12:27:38 by panne] X-Git-Tag: Initial_conversion_from_CVS_complete~1834 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=4a41cd9afd043c4c7cb625c214f51605640c01c1;p=ghc-hetmet.git [project @ 2004-05-22 12:27:38 by panne] Reverse the order in which DLLs are loaded. This makes more sense in general and should fix the trouble with the broken OpenGL libs on Gentoo. This fix has been tested on x86 Linux, but reports from other platforms (WinDoze, MacOS X, ...) are highly welcome, dynamic linking is quite platform-specific and surprising things can happen from time to time... Merge to STABLE when tested on other platforms --- diff --git a/ghc/compiler/ghci/Linker.lhs b/ghc/compiler/ghci/Linker.lhs index f8237dc..ebccb9f 100644 --- a/ghc/compiler/ghci/Linker.lhs +++ b/ghc/compiler/ghci/Linker.lhs @@ -771,7 +771,14 @@ linkPackage dflags pkg -- See comments with partOfGHCi when (Packages.name pkg `notElem` partOfGHCi) $ do loadFrameworks pkg - mapM_ (load_dyn dirs) dlls + -- When a library A needs symbols from a library B, the order in + -- extra_libraries/extra_ld_opts is "-lA -lB", because that's the + -- way ld expects it for static linking. Dynamic linking is a + -- different story: When A has no dependency information for B, + -- dlopen-ing A with RTLD_NOW (see addDLL in Linker.c) will fail + -- when B has not been loaded before. In a nutshell: Reverse the + -- order of DLLs for dynamic linking. + mapM_ (load_dyn dirs) (reverse dlls) -- After loading all the DLLs, we can load the static objects. mapM_ loadObj objs