On 14 April 2012 22:40, Walter Bright <newshou...@digitalmars.com> wrote:
> On 4/14/2012 2:40 AM, Vladimir Panteleev wrote: > >> So object files take priority over library files? >> > > Yes, because object files are NOT searched. They are incorporated. > Libraries get recursively searched for unresolved symbols. > I was under the impression library files were nothing more than a collection of object files? On 14 April 2012 22:44, Walter Bright <newshou...@digitalmars.com> wrote: > Is this also how ld and link.exe works? >> > > It's how every linker I've ever used and heard of works. > > Keep in mind that an object file consists of blocks of BINARY data > attached to symbols. There is no meaning in the binary data. The linker > knows nothing about the meaning of that binary data, or where it came from. > Run the "dumpobj" utility over an object file and you'll see what I mean. > I'm aware of how a linker works :) .. I wouldn't expect the linker to be able to resolve multiply defined symbols though without instruction... I just tried it, and I got the error I expected: LIBCMTD.lib(atox.obj) : error LNK2005: _atoi already defined in Unit.obj In C, I would always explicitly declare weak linkage to do this... what's the point of the weak attribute if not for this?