Potential of a compiler that creates the executable at once
max haughton
maxhaton at gmail.com
Fri Feb 11 03:45:28 UTC 2022
On Thursday, 10 February 2022 at 22:52:45 UTC, Walter Bright
wrote:
> On 2/10/2022 2:06 PM, Dave P. wrote:
>> Undefined symbols for architecture arm64:
>> "__D7example9some_funcFiZi", referenced from:
>> __D7example3fooFiZi in example.o
>> __D7example3barFiZi in example.o
>> __D7example3bazFiZi in example.o
>> __D7example3quxFiZi in example.o
>> __Dmain in example.o
>> ld: symbol(s) not found for architecture arm64
>
> Things I have never been able to explain, even to long time
> professional programmers:
>
> 1. what "undefined symbol" means
>
> 2. what "multiply defined symbol" means
>
> 3. how linkers resolve symbols
>
> Our own runtime library illustrates this bafflement. In
> druntime, there are these "hooks" where one can replace the
> default function that deals with assertion errors.
>
> Such hooks are entirely unnecessary.
>
> To override a symbol in a library, just write your own function
> with the same name and link it in before the library.
>
> I have never been able to explain these to people. I wonder if
> it is because it is so simple, people think "that can't be
> right". With the hook thing, they'll ask me to re-explain it
> several times, then they'll say "are you sure?" and they still
> don't believe it.
If by hook you mean a callback of sorts that can be overrided,
then the problem solved is not strictly the same as a weakly
defined function. If you have multiple library's in the same
playpen then it simply doesn't work to have them all trying to
override the same symbols. If they can neatly hook and unhook
things that goes away.
More information about the Digitalmars-d
mailing list