[Haskell-cafe] Embedding ghc

Brian Smith brianlsmith at gmail.com
Sat Feb 10 09:26:31 EST 2007

"If you have to ask, you can't afford it." :)

The GHC API is not modular--if you use it, then the entirety of GHC is
included into your program. That means that your executable will increase by
the size of ghc.exe.

Furthermore, you will also need to ship several of the supporting
executables, alongside the result. Basically, using the GHC API is going to
add nearly the entire size of the full GHC distribution to your application.

On Windows, If you don't use via-C code generation, then you might be able
to cut out some parts of the embedded GCC distribution (libraries, etc.)

I once looked at modularizing GHC so that parts like the bytecode
interpreter, via-C compilation, template haskell, and compilation to/from
external core could be removed to reduce the size of the program. However,
it is non-trivial to do this, and I didn't want to maintain a branch of GHC
with these parts factored out. it would be better to come up with a proposal
that the GHC maintainers will accept for the mainline, and then implement
it, if you want a modular GHC. I would like to do so but currently I am busy
on other projects.

- Brian

On 2/10/07, Joel Reymont <joelr1 at gmail.com> wrote:
> Has anyone tried embedding ghc into their app?
> How big are the resulting binaries?
>         Thanks, Joel
> --
> http://wagerlabs.com/
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070210/a6cd1dc5/attachment.htm

More information about the Haskell-Cafe mailing list