This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Strange DLL linking problem (Windows)



> > I've looked at the binutils source, but can't work out where the DLL names
> > are written into the executable, and hence, how the ordering is decided.
> 
> I'm not aware of anything in the generic linker that would cause the
> problem you describe, but there's some weird code in ld/emultemp/pe.em
> that I don't fully understand.  You may strike pay-dirt if you poke around
> there.

It's stranger.

The DLL names are written into the import library (*.a) when the DLL
is created.  When you link in the import library, one of the objects
happens to have the name of the dll in it.

If you link against a DLL directly (instead of using an import
library), the linker creates an import library (ld/pe-dll.c) and links
against that.

The weird code in pe.em is there because MS, in their infinite wisdom,
give every object in each library the same exact name, so i rename
them so that they can be sorted correctly (within each dll, not
relative to other dlls).  The other bit deals with the case where an
import library is listed twice, since that leads to corrupt
executables if not handled properly.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]