On 4/14/2012 9:23 PM, Vladimir Panteleev wrote:
On Saturday, 14 April 2012 at 19:41:22 UTC, Walter Bright 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.

Right, I understand the case when you declare an assert handler and use it in
the same module (thus, object file) - then, an external is not used and for PIC
there might not even be a relocation record. However, if the assert statement
and my assert handler are in different modules, how does the linker know not to
search the libraries without first searching other object files?

?? The linker takes the list of object files supplied on the command line and incorporates them. Then it looks in the library for any unresolved symbols.

The linker does NOT "search" object files passed on the command line. It ALWAYS simply incorporates them.

It is far far simpler than you are imagining it is. A linker is a very simple, stupid program.

Reply via email to