compiling libraries with ghc

Simon Marlow simonmar@microsoft.com
Mon, 24 Jun 2002 12:03:05 +0100


> hi, i wrote some utilities to make my coding a little easier=20
> and i put them in some libraries. then to use them i made a=20
> package conf file and added it with ghc-pkg -a. i then tried=20
> compiling them with
>=20
> ghc -package-name extensions -c Foo.hs
>=20
> but i am not sure i am compiling it right as i get linker=20
> errors of the form
>=20
> /usr/libexec/elf/ld: cannot find -lDirectoryAndExtensions
>=20
> whenever i try to compile a program that uses my libraries.

I can't tell exactly what's wrong from this error message - what does
your package conf file look like?

> i can fix this by copying all the .o files to libFoo.a files.=20
> what is the right way to compile libraries?

You should make a lifFoo.a for static linking, and a single Foo.o for
use with GHCi.  The documentation on packages in the user guide explains
how to do this.

Cheers,
	Simon