When linking a dll file with ld, where -la and -llib libraries used, order of
-la and -llib matters if these libraries are in .a and .lib formats, respectively.
The link below points to the setup that can be used to reproduce this
problem. Namely, passing "-la -llib" produces error
./lib.lib(lib.obj):lib.c:(.text+0x4): undefined reference to `_wlib'
whereas passing "-llib -la" succeeds. There, wlib is exported by lib.lib, and
used by liba.a .
Subject: Re: New: ld: failure depending on order of -l libs
What is the bug? The order is significant by design.
Uhm. I didn't know that it is significant by design. Well if it is, then I guess
there's no bug and you may as well close the ticket. However, may I ask for
links for further reading? I can't find anything relevant myself. Thanks!
Subject: Re: ld: failure depending on order of -l libs
There is a brief explanation in the manual in the section describing
--start-group/--end-group. This behavior is not unique to GNU ld, I'm
pretty sure if you went back to the original SysV/BSD linker you'd find
the same algorithm.
That's what I needed, thanks!