linker wrapper

2010-11-11 Thread Steven Schveighoffer
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 proble

Re: linker wrapper

2010-11-11 Thread Denis Koroskin
On Thu, 11 Nov 2010 15:54:50 +0300, Steven Schveighoffer 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

Re: linker wrapper

2010-11-11 Thread Steven Schveighoffer
hat 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

Re: linker wrapper

2010-11-11 Thread bearophile
Denis Koroskin: > 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 te

Re: linker wrapper

2010-11-11 Thread Andrei Alexandrescu
On 11/11/10 4:54 AM, Steven Schveighoffer 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 woul

Re: linker wrapper

2010-11-11 Thread Andrei Alexandrescu
nd 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

Re: linker wrapper

2010-11-11 Thread Walter Bright
Andrei Alexandrescu wrote: Mangled symbols are the main reason for which linker messages are considered incomprehensible. I beg to differ. The same confusion appears when linking C programs, where the names are not mangled. Top 3 linker questions: 1. What does it mean when it says "foo is r

Re: linker wrapper

2010-11-11 Thread Walter Bright
Andrei Alexandrescu wrote: Apparently gnu's ld demangles by default: http://linux.die.net/man/1/ld (Search for "demangle".) But it recognizes C++ mangling, not D mangling. The same for optlink.

Re: linker wrapper

2010-11-11 Thread Rainer Schuetze
Denis Koroskin wrote: 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Ђ—ќЂ˜ґЂ—˜".

Re: linker wrapper

2010-11-11 Thread bearophile
Walter: > While it's nice to demangle the names, and optlink does so for C++ names, it > doesn't reduce the confusion about what the linker is doing. Surprisingly, I > see > these questions not just from newbies, but regularly from people with 10+ > years > of experience. What the linker is

Re: linker wrapper

2010-11-11 Thread Walter Bright
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

Re: linker wrapper

2010-11-11 Thread Walter Bright
Rainer Schuetze wrote: Denis Koroskin wrote: 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__T3a

Re: linker wrapper

2010-11-12 Thread Rainer Schuetze
Walter Bright wrote: Rainer Schuetze wrote: Walter, is optlink able to deal with this 3rd representation in all places, so we can get rid of those other two encodings? The way long symbols on Windows are dealt with: 1. if they fit, they fit 2. try using the extended length method 3. try co

Re: linker wrapper

2010-11-12 Thread spir
On Thu, 11 Nov 2010 18:28:08 -0500 bearophile wrote: > Walter: > > > While it's nice to demangle the names, and optlink does so for C++ names, > > it > > doesn't reduce the confusion about what the linker is doing. Surprisingly, > > I see > > these questions not just from newbies, but regula

Re: linker wrapper

2010-11-12 Thread Steven Schveighoffer
On Thu, 11 Nov 2010 20:03:21 -0500, Walter Bright 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 *

Re: linker wrapper

2010-11-13 Thread bearophile
Walter: > Top 3 linker questions: > > 1. What does it mean when it says "foo is referenced but not defined" ? > > 2. What does it mean when it says that "foo is defined in more than one > module" ? > > 3. Why is my executable file so large? > > > While it's nice to demangle the names, and op

Re: linker wrapper

2010-11-13 Thread Walter Bright
bearophile wrote: A new fresh trouble, I think I have already seen about 10-15 persons ask this question in D.learn: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=22772 http://www.digitalmars.com/ctg/OptlinkErrorMessages.html#symbol_undefined

Re: linker wrapper

2010-11-13 Thread bearophile
Walter Bright: > bearophile wrote: > > A new fresh trouble, I think I have already seen about 10-15 persons ask > > this question in D.learn: > > http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=22772 > > http://www.digitalmars.com/ctg/OptlinkErrorMessag

Re: linker wrapper

2010-11-13 Thread Andrew Wiley
On Sat, Nov 13, 2010 at 5:02 PM, bearophile wrote: > Walter Bright: > > > bearophile wrote: > > > A new fresh trouble, I think I have already seen about 10-15 persons > ask this question in D.learn: > > > > http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=

Re: linker wrapper

2010-11-13 Thread bearophile
Andrew Wiley: > Learning to > operate a compiler and linker is a fundamental part of programming pretty > much any compiled language, and taking it away encourages the user to not > care how their code becomes an executable. To me, this seems like a large > disservice. Many new programmers don't

Re: linker wrapper

2010-11-13 Thread Andrew Wiley
On Sat, Nov 13, 2010 at 9:14 PM, bearophile wrote: > > > If you don't even see the usefulness of more readable linker errors then... > why are where here? Aren't we trying to improve older languages? I said that improved error messages would be helpful. I may have misinterpreted you when you said

Re: linker wrapper

2010-11-13 Thread Walter Bright
Andrew Wiley wrote: I interpreted this as the compiler adding modules that were unspecified on the command line when calling the linker. If you meant that the compiler should search for additional required modules for more useful error messages, I agree with that sentiment. As written, it seems

Re: linker wrapper

2010-11-14 Thread Rainer Deyke
On 11/14/2010 00:09, Walter Bright wrote: > I suspect that trying to guess what modules should be added to the > linker list may cause far more confusion than enlightenment when it goes > awry. Currently, a lot of people seem to regard what a linker does as > magic. Making it more magical won't hel

Re: linker wrapper

2010-11-14 Thread Walter Bright
Rainer Deyke wrote: On 11/14/2010 00:09, Walter Bright wrote: I suspect that trying to guess what modules should be added to the linker list may cause far more confusion than enlightenment when it goes awry. Currently, a lot of people seem to regard what a linker does as magic. Making it more ma

Re: linker wrapper

2010-11-15 Thread Kagamin
bearophile Wrote: > Probably we'll see more people asking for that kind of help. Not all D > newbies come from languages that use a linker. Today a significant and > growing percentage of newbie D programmers come from Java, C#, JavaScript, > Python, etc. java and c# do use a linker (I suppose

Re: linker wrapper

2010-11-15 Thread bearophile
Kagamin: > java and c# do use a linker (I suppose you just didn't use them). It's > builtin, but still suffers from the same problems as traditional linkers. I generally try to talk only about the things I know something about, but I don't know enough about linkers yet, I am sorry. Bye, bearop