On Sun, Jun 12, 2011 at 11:45 AM, Brandon Allbery <allber...@gmail.com> wrote: > On Sun, Jun 12, 2011 at 14:31, Jason Dagit <dag...@gmail.com> wrote: >> If I build the C library as a .a, then ghci comlains that it cannot >> open the .dylib. My first question is: Why does ghci need a .dylib >> and does it really use it? > > Static libraries are... static. ghci would have to rebuild itself > against the static archive to use it; that's how static archives work. > Dynamic libraries are dynamic because they can be loaded at runtime > instead of compile time.
Interesting. When I use dtruss to see what files ghci opens, it definitely opens .a files. That gave me the impression it knows how to open a .a and use it at run-time. >> When I build a dylib I get a [segfault when loading the code into ghci][2]. > > I believe ghci still uses its own dynamic loader instead of the > standard library one, and as such it doesn't handle everything quite > correctly; Mach-O is a moving target and Apple doesn't always document > its changes.[1] When you compile, the system linker is used to build > the executable and things work properly. > > [1] http://hackage.haskell.org/trac/ghc/ticket/4244 > It's hard for me to make sense of that ticket with so little context. This comment seems to go against what you're saying: Changed 10 months ago by igloo milestone set to 6.16.1 The best way to achieve this is probably to switch to using dynamic libraries for GHCi. Thanks, Jason _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe