are also a good way to provide convenient access to a Haskell
layer over a C library.</para>
- <para>GHC comes with several packages (see <xref
- linkend="book-hslibs">), and packages can be added to or removed
+ <para>GHC comes with several packages (see the accompanying
+ library documentation), and packages can be added to or removed
from an existing GHC installation, using the supplied
<literal>ghc-pkg</literal><indexterm><primary><literal>ghc-pkg</literal></primary>
</indexterm> tool, described in <xref
<listitem>
<para>A package has a name
- (e.g. <filename>std</filename>)</para>
+ (e.g. <filename>base</filename>)</para>
</listitem>
<listitem>
<para>The Haskell code in a package may be built into one or
- more archive libraries (e.g. <filename>libHSfoo.a</filename>),
- or a single DLL on Windows
- (e.g. <filename>HSfoo.dll</filename>). The restriction to a
- single DLL on Windows is that the package system is used to
- tell the compiler when it should make an inter-DLL call
- rather than an intra-DLL call (inter-DLL calls require an
- extra indirection). <emphasis>Building packages as DLLs
- doesn't work at the moment; see <XRef
- LinkEnd="win32-dlls-create"> for the gory details.</emphasis>
+ more archive libraries
+ (e.g. <filename>libHSfoo.a</filename>), or a single DLL on
+ Windows (e.g. <filename>HSfoo.dll</filename>). The
+ restriction to a single DLL on Windows is because the
+ package system is used to tell the compiler when it should
+ make an inter-DLL call rather than an intra-DLL call
+ (inter-DLL calls require an extra
+ indirection). <emphasis>Building packages as DLLs doesn't
+ work at the moment; see <XRef LinkEnd="win32-dlls-create">
+ for the gory details.</emphasis>
</para>
+ <para>Building a static library is done by using the
+ <literal>ar</literal> tool, like so:</para>
+
+<screen>ar cqs libHSfoo.a A.o B.o C.o ...</screen>
+
+ <para>where <filename>A.o</filename>,
+ <filename>B.o</filename> and so on are the compiled Haskell
+ modules, and <filename>libHSfoo.a</filename> is the library
+ you wish to create. The syntax may differ slightly on your
+ system, so check the documentation if you run into
+ difficulties.</para>
+
<para>Versions of the Haskell libraries for use with GHCi
may also be included: GHCi cannot load <literal>.a</literal>
files directly, instead it will look for an object file
- called <filename>HSfoo.o</filename> and load that. The
- <literal>ghc-pkg</literal> tool can automatically build the
- GHCi version of each library, see <xref
- linkend="package-management">. To build these libraries by
- hand from the <literal>.a</literal> archive, it is possible
- to use GNU <command>ld</command> as follows:</para>
+ called <filename>HSfoo.o</filename> and load that. On some
+ systems, the <literal>ghc-pkg</literal> tool can
+ automatically build the GHCi version of each library, see
+ <xref linkend="package-management">. To build these
+ libraries by hand from the <literal>.a</literal> archive, it
+ is possible to use GNU <command>ld</command> as
+ follows:</para>
<screen>ld -r ––whole-archive -o HSfoo.o libHSfoo.a</screen>
</listitem>
</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>––force</option></term>
+ <indexterm><primary><option>––force</option></primary></indexterm>
+ <listitem>
+ <para>Causes <literal>ghc-pkg</literal> to ignore missing
+ directories and libraries when adding a package, and just
+ go ahead and add it anyway. This might be useful if your
+ package installation system needs to add the package to
+ GHC before building and installing the files.</para>
+ </listitem>
+ </varlistentry>
</variablelist>
<para>When modifying the configuration file
<varlistentry>
<term><filename>libHSfoo.a</filename></term>
<listitem>
- <para>The name of the library on Unix
+ <para>The name of the library on Unix and Windows
+ (mingw) systems. Note that we don't support
+ building dynamic libraries of Haskell code on Unix
systems.</para>
</listitem>
</varlistentry>
<term><filename>HSfoo.dll</filename></term>
<listitem>
<para>The name of the dynamic library on Windows
- systems.</para>
+ systems (optional).</para>
</listitem>
</varlistentry>
<varlistentry>
for libraries in
<literal>extra_libraries</literal>.</para>
+ <para>The libraries listed in
+ <literal>extra_libraries</literal> may be any libraries
+ supported by your system's linker, including dynamic
+ libraries (<literal>.so</literal> on Unix,
+ <literal>.DLL</literal> on Windows).</para>
+
<para>Also, <literal>extra_libraries</literal> are placed
on the linker command line after the
<literal>hs_libraries</literal> for the same package. If
(for linking) when this package is being used.</para>
</listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><literal>framework_dirs</literal></term>
+ <indexterm><primary><literal>framework_dirs</literal></primary>
+ <secondary>package specification</secondary></indexterm>
+ <listitem>
+ <para>On Darwin/MacOS X, a list of directories containing frameworks for this
+ package. This corresponds to the <option>-framework-path</option> option.
+ It is ignored on all other platforms.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>extra_frameworks</literal></term>
+ <indexterm><primary><literal>extra_frameworks</literal></primary>
+ <secondary>package specification</secondary></indexterm>
+ <listitem>
+ <para>On Darwin/MacOS X, a list of frameworks to link to. This corresponds to the
+ <option>-framework</option> option. Take a look at Apple's developer documentation
+ to find out what frameworks actually are. This entry is ignored on all other platforms.</para>
+ </listitem>
+ </varlistentry>
</variablelist>
<para>