[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Support for dynamic libraries



On March 16, 2010 06:00:23 Joachim Breitner wrote:
> What benefits would we get from dynamic libraries, besides smaller
> binaries?

1 - Plugins for other programs.

I'm interfacing Perl and Haskell (from the Perl side) for a project at work.

This means I have to make a shared library for Perl to load.  While, it is 
true that I could shove the entire GHC runtime into the shared library I'm 
building for Perl to load, this has at least two major problems

a) Non-shared library components are not compiled with -fPIC, so I have to 
manually recompile them all (this includes the base ghc library) in order to 
build my shared library.

b) If you loading more than one library built this way, then you have multiple 
copies of the GHC runtime system in memory.  Even assuming there are no symbol 
clashes so it is possible, they won't be able to interoperate with each other 
at all as the independent garbage collectors don't know each other roots.

2 - Smaller memory footprint

Linux will share the shared library memory pages between multiple executing 
Haskell programs, which significantly reduces their combined memory footprint.

Cheers!  -Tyson

PS:  Personally, I think smaller binaries are a plus too on the road to world 
domination.  While it is true that disks are a lot bigger now, any system that 
has run long enough still becomes chronically short, and, given no other 
reason to choose between two programs, people will likely take the smaller.

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: