linker wrapper

Denis Koroskin 2korden at gmail.com
Thu Nov 11 05:20:46 PST 2010


On Thu, 11 Nov 2010 15:54:50 +0300, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:

> Just saw another linker error in d.learn, and it got me thinking
>
> dmd just calls the linker, and the linker spits out link errors.  But  
> what if we had a 'linker wrapper' program which translated mangled names  
> into demangled names?  It would at least help people understand the  
> problem better.  How many times does a newbie come back and say "I have  
> this problem, and dmd spits out some weird message I don't understand"  
> and it takes a person who half-speaks mangled d names to understand what  
> the name is.
>
> Given that D already includes a demangler, wouldn't it be rather trivial  
> to write this program in D?
>
> I know it would make my life a bit better.
>
> Thoughts?  Takers?
>
> -Steve

I suggested that previously [1], and I think that need to be a part of DMD  
for a simple reason: some of the names can't be demangled because their  
are somewhat "hashed" to avoid limitations such as long literal name. E.g.  
"_D4math6Mбrix9х44F32__T3addTCЂ–ЎZЂ„ќFЂ—ќЂ˜ґЂ—˜".

Given that dmd calls a linker internally, it could also retrieve linker  
errors (if any present), translate and then show them, with a list of  
suggestions to fix the problem if possible. Here are an example:

module test1;
void foo() {}

module test2;
import test1;
void main() { foo(); }

#dmd test2.d

Desired output: Error: No implementation found for method void foo()  
defined in module test1. Try linking with test1.d
Actual output: Error 42: Symbol Undefined _D5test13fooFZv

[1] http://d.puremagic.com/issues/show_bug.cgi?id=2238


More information about the Digitalmars-d mailing list