--out-implib when linking shared libraries
Neil Mitchell
ndmitchell at gmail.com
Sat May 16 06:07:18 EDT 2009
>> 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?
>
> It looks like what you're getting is an import lib that also contains a
> full copy of all the code.
Yes, that seems likely. My guess is it's just a cat of the .o's, with
header tables etc.
> 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).
I don't, although having that option wouldn't be a bad thing - having
a minimal .lib is perfectly reasonable as a default. Having a massive
.lib seems crazy. (The fact that .lib is named .dll.a isn't too much
of an issue)
> So my suggestion is remove it, if you're linking using gcc it should
> work.
I'm not linking the .dll at all, only using dynamic linking, which
works without the .lib. But I don't really want to start removing
files - doing that in a build system seems like a bad idea.
Thanks
Neil
More information about the Glasgow-haskell-users
mailing list