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]

Strange DLL linking problem (Windows)


I am using ld via Cygwin gcc 2.95.2, binutils 20001029-2. I have found that
linking a program dynamically with identical import libraries can produce
different results depending on the order in which the directories holding
the import libraries were created.

For example, if my -L flags go:

-Lfoo1 -Lfoo2 -Lfoo3

where I originally went "mkdir foo1; mkdir foo2; mkdir foo3", I get
different results from using exactly the same -L flags but where the
directories were created using "mkdir foo3; mkdir foo2; mkdir foo1".

The difference in the resulting executables is that the DLLs are listed in
the executable in a different order.

This would be of only academic interest, except that, for reasons I also
don't understand, the executable linked in one of the orders works fine,
whereas that linked in the other order crashes on startup, with a message of
the form:

The application failed to initialize properly (0xc0000005).

It seems that this indicates a failure to resolve the inter-DLL references.

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.

Can anyone help? The application I am working on is the Glasgow Haskell
Compiler, which keeps its libraries in DLLs. This is a showstopper bug for
us at the moment, as we can't reliably use DLLized libraries until it's fixed.

-- 
http://sc3d.org/rrt/ | violence, n.  bravery for cowards


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