--out-implib when linking shared libraries

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Fri May 15 13:34:26 EDT 2009


On Fri, 2009-05-15 at 15:31 +0100, Neil Mitchell wrote:
> Hi,
> 
> I've just built a Haskell dll on Windows. As part of the process it
> generated an 14Mb foo.dll, and a 40Mb foo.dll.a. Looking at the flags
> passed to ld I see --out-implib=foo.dll.a. What is the purpose of the
> .a file? What might it be needed for? Is it possible to suppress it?

I'm less familiar with the windows dlls as I've been working on the unix
case first, but as I understand it, .lib files serve a dual purpose as
static libs and as import libs for corresponding dlls. To add confusion
the windows gnu tools use the .dll.a extension rather than .lib which
the MS tools use.

It looks like what you're getting is an import lib that also contains a
full copy of all the code.

I think it's possible to have minimal .lib files that do not contain any
code and only refer to the corresponding dll. Further, I think recent
gnu ld versions can link directly against dlls without using an import
lib (though you may still need the import lib if you want to use MSVC to
link to your dll).

So my suggestion is remove it, if you're linking using gcc it should
work.

See also:
http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/gnu-linker/win32.html

Duncan



More information about the Glasgow-haskell-users mailing list