From 551edc4344bb9848e367034c44bee0646b394be2 Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 10 Sep 2002 09:26:24 +0000 Subject: [PATCH] [project @ 2002-09-10 09:26:24 by simonmar] Add notes on how to build a .a file to the docs, as requested by Koen Claessen. --- ghc/docs/users_guide/packages.sgml | 58 +++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/ghc/docs/users_guide/packages.sgml b/ghc/docs/users_guide/packages.sgml index 6faac0a..769a7cd 100644 --- a/ghc/docs/users_guide/packages.sgml +++ b/ghc/docs/users_guide/packages.sgml @@ -101,31 +101,45 @@ A package has a name - (e.g. std) + (e.g. base) The Haskell code in a package may be built into one or - more archive libraries (e.g. libHSfoo.a), - or a single DLL on Windows - (e.g. HSfoo.dll). 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). Building packages as DLLs - doesn't work at the moment; see for the gory details. + more archive libraries + (e.g. libHSfoo.a), or a single DLL on + Windows (e.g. HSfoo.dll). 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). Building packages as DLLs doesn't + work at the moment; see + for the gory details. + Building a static library is done by using the + ar tool, like so: + +ar cqs libHSfoo.a A.o B.o C.o ... + + where A.o, + B.o and so on are the compiled Haskell + modules, and libHSfoo.a is the library + you wish to create. The syntax may differ slightly on your + system, so check the documentation if you run into + difficulties. + Versions of the Haskell libraries for use with GHCi may also be included: GHCi cannot load .a files directly, instead it will look for an object file - called HSfoo.o and load that. The - ghc-pkg tool can automatically build the - GHCi version of each library, see . To build these libraries by - hand from the .a archive, it is possible - to use GNU ld as follows: + called HSfoo.o and load that. On some + systems, the ghc-pkg tool can + automatically build the GHCi version of each library, see + . To build these + libraries by hand from the .a archive, it + is possible to use GNU ld as + follows: ld -r ––whole-archive -o HSfoo.o libHSfoo.a @@ -408,7 +422,9 @@ libHSfoo.a - The name of the library on Unix + 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. @@ -416,7 +432,7 @@ HSfoo.dll The name of the dynamic library on Windows - systems. + systems (optional). @@ -452,6 +468,12 @@ for libraries in extra_libraries. + The libraries listed in + extra_libraries may be any libraries + supported by your system's linker, including dynamic + libraries (.so on Unix, + .DLL on Windows). + Also, extra_libraries are placed on the linker command line after the hs_libraries for the same package. If -- 1.7.10.4