how to link a minimal executable?

Simon Marlow marlowsd at gmail.com
Thu Aug 12 05:33:58 EDT 2010


On 11/08/2010 22:31, Greg Fitzgerald wrote:
> Is there any documentation or examples available that shows what needs
> to be linked to get a haskell executable to print "hello world"?
>   Instead of using GHC to link, I'm interested in using gcc, ar, or link
> directly.  For starters, what implements the entry point?

HSrtsmain.a provides the entry point, though you can provide your own if 
you want.  The minimum set of libraries required would be the base 
package (for Prelude), and its dependencies, namely ghc-prim, 
integer-gmp, and of course the RTS and libffi.  The -u flags you see in 
the linker command line are there because there is a circular dependency 
between the RTS and the base package, and they avoid us having to link 
those several times to reach a fixed point.

Cheers,
	Simon


More information about the Glasgow-haskell-users mailing list