Haskell Dynamic Loading with -fllvm

Simon Marlow marlowsd at gmail.com
Thu Dec 13 14:27:23 CET 2012

On 12/12/12 18:03, David Terei wrote:
> Hi Nathan,
> So dynamic libraries should be supported on a few platforms but not
> all, not as many as the NCG. Support also varies from LLVM version.
> What platform and version of LLVM are you trying to utilize? And
> specifically what flags are you using?

Also I believe even if it works, the code that LLVM generates for 
-dynamic is not very good.  This is because it makes every symbol 
reference a dynamic reference, whereas the NCG only makes dynamic 
references for symbols in other packages.  It ought to be possible to 
fix this by using the right symbol declarations (I'm guessing, I haven't 
looked into it).


> Cheers,
> David
> On 11 December 2012 08:53, Nathaniel Neitzke <nightski at gmail.com> wrote:
>> Essentially I have a use case that, if worked, would save countless hours in
>> development time.  I am writing a scientific computing web service utilizing
>> the Repa and Snap libraries.  The Snap framework has a dynamic loader that
>> will load modules on the fly when the source files change.
>> This works excellent!  The problem is that the modules must be compiled with
>> full optimizations (including -fllvm) or web service operations take minutes
>> instead of < second to execute at run time.  I do not mind the penalty paid
>> for optimized compilation.  It is still much faster than recompiling and
>> linking the entire exe from scratch and restarting the server.
>> The problem is when the code is compiled with -fllvm dynamically, it
>> crashes.  I believe this is a known issue as listed in this trac -
>> http://hackage.haskell.org/trac/ghc/ticket/4210
>> NOTE: it says "The LLVM backend doesn't support dynamic libraries at the
>> moment."
>> My question is could anyone point me in the right direction as to what might
>> need to be implemented support for this?  Is anyone currently working on it?
>> It would be a huge win for the work I am currently doing, to the point where
>> if I can't find a way to get this working (even if it means diving in and
>> attacking it myself), I may have to switch to another language/platform.
>> Thanks,
>> Nathan
>> _______________________________________________
>> Glasgow-haskell-users mailing list
>> Glasgow-haskell-users at haskell.org
>> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

More information about the Glasgow-haskell-users mailing list