linker wrapper

Steven Schveighoffer schveiguy at yahoo.com
Fri Nov 12 04:38:55 PST 2010


On Thu, 11 Nov 2010 20:03:21 -0500, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> bearophile wrote:
>> What the linker is doing is something that conceptually is not complex,  
>> so an
>> average programmer is supposed to understand what are the problems a  
>> linker
>> may encounter in its work.
>
> The linker is a conceptually *trivial* program. It baffles me why  
> programmers with 10+ years of experience in C and C++ are stumped by  
> "undefined symbol" messages, cannot look at a linker map file, etc.
>
> It's like being a C programmer and not knowing what a pointer is.

Where is the linker in this line?

dmd a.d b.d

The problem I see is that the compilers of today hide the fact that a  
linker is being used.  A lot of coders now use IDEs and don't even know  
how to use the compiler directly, let alone the linker.

Just the other day, I was "baffled" by a link error, where a symbol was  
multiply defined (C project).  The answer was this problem:

#include "module1.h"
#include "module2.c"

Took me a while to see it :) (note I didn't write this, a co-worker who  
has very little experience with C did :)

I guess it's not so much we don't understand that the linker can't find  
the object, or that it's multiply defined, it's just hard to connect that  
with the root cause.  More information never hurts, and let's face it, we  
have a computer at our disposal!  One that has suddenly been given a lot  
of free time because it's no longer compiling.  Having it figure out as  
much as it can is beneficial to all.

Back to the problem at hand though, if the linker could demangle the  
symbol, or some wrapper could, people would have a much better idea of  
where the problem is.  I don't care how many years experience you have, if  
you can demangle symbols in your head, you are one of a gifted few.  I  
shouldn't have to get out my decoder ring to understand linker errors.

-Steve


More information about the Digitalmars-d mailing list