The Linker is not a Magical Program
A rant I wrote a few months ago: http://programmer.97things.oreilly.com/wiki/index.php/The_Linker_Is_not_a_Magical_Program
Re: The Linker is not a Magical Program
That is probably because most books don't explain it properly. Heck my C++ book doesn't even mention it. And for the extern keyword there is only one very short explanation. extern: Storage class for objects declared outside the local block. Oh and I read your rant about linkers, ... and it still looks magical. And I bet Andrei's book will keep it short too. And Magic isn't always a bad thing. And the D shared libraries thing, very complex, no magic. C# assemblies. Everything just works, magic.
Re: The Linker is not a Magical Program
I was wondering if the following is useful, probably not. Reserve a spot on the vtable, which is automatically set to NULL. class AClass { __virtualspot void caption(string text); //no implementation __virtualspot string caption(); } class BClass:AClass { } BClass b = new BClass(); b.caption = test; //compiles 1. Would compile. But it would not run if the vtable spot has not been filled up by some API. 2. Can derive from the class/interface, without providing the implementation.
Re: The Linker is not a Magical Program
Walter Bright Wrote: A rant I wrote a few months ago: http://programmer.97things.oreilly.com/wiki/index.php/The_Linker_Is_not_a_Magical_Program Great read, reminded me of my first weeks in C/C++ land, back when I couldn't tell the compiler from the linker :) These days only the OMF format on Windows still seems magic because I can't find any decent documentation on its format. I had the hardest of times putting together a CodeView reader, finally got one working after consulting at least 10 different documents, looking at shitloads of codeview data in hex editors, and plenty of trial and error magic, and I still only support version 4.10, but I guess that makes me a magician! Now if I only can find enough documentation about OMF to write a COFF to OMF converter.. there are still a bunch of libraries I use in C which I'd like to compile to static libraries in VC++ and link in DMD. I tried compiling with DMC to generate static OMF libraries directly, but they always fail on missing files like xmmintrin.h and other misc issues. I also searched the web high and low for a coff2omf binary and only found one which generate broken libraries, dmd won't see any symbols in the converted files and the linker goes crazy on unresolved references. I tried link /CONVERT only to find out there is no /CONVERT option. So yeah, the linker is not a magical program, but it does operate in a magical world.
Re: The Linker is not a Magical Program
Jeremie Pelletier wrote: Now if I only can find enough documentation about OMF to write a COFF to OMF converter.. http://www.azillionmonkeys.com/qed/Omfg.pdf
Re: The Linker is not a Magical Program
Walter Bright wrote: Jeremie Pelletier wrote: Now if I only can find enough documentation about OMF to write a COFF to OMF converter.. http://www.azillionmonkeys.com/qed/Omfg.pdf What I always wanted to know: besides OPTLINK, is there an OMF linker that can link D programs? I couldn't find one.
Re: The Linker is not a Magical Program
Walter Bright Wrote: Jeremie Pelletier wrote: Now if I only can find enough documentation about OMF to write a COFF to OMF converter.. http://www.azillionmonkeys.com/qed/Omfg.pdf Sweet, you're the man Walter!
Re: The Linker is not a Magical Program
grauzone wrote: Walter Bright wrote: Jeremie Pelletier wrote: Now if I only can find enough documentation about OMF to write a COFF to OMF converter.. http://www.azillionmonkeys.com/qed/Omfg.pdf What I always wanted to know: besides OPTLINK, is there an OMF linker that can link D programs? I couldn't find one. Maybe the watcom one. But I've never tried it.
Re: The Linker is not a Magical Program
Walter Bright wrote: grauzone wrote: Walter Bright wrote: Jeremie Pelletier wrote: Now if I only can find enough documentation about OMF to write a COFF to OMF converter.. http://www.azillionmonkeys.com/qed/Omfg.pdf What I always wanted to know: besides OPTLINK, is there an OMF linker that can link D programs? I couldn't find one. Maybe the watcom one. But I've never tried it. I know someone who tried sufficiently hard, but failed. But I don't remember what exactly was the problem.
Re: The Linker is not a Magical Program
grauzone wrote: Walter Bright wrote: grauzone wrote: Walter Bright wrote: Jeremie Pelletier wrote: Now if I only can find enough documentation about OMF to write a COFF to OMF converter.. http://www.azillionmonkeys.com/qed/Omfg.pdf What I always wanted to know: besides OPTLINK, is there an OMF linker that can link D programs? I couldn't find one. Maybe the watcom one. But I've never tried it. I know someone who tried sufficiently hard, but failed. But I don't remember what exactly was the problem. What originally motivated me to get our own linker was the erratic reliability of other ones.
Re: The Linker is not a Magical Program
在 Fri, 04 Sep 2009 04:39:28 +0800,Sclytrack id...@hotmail.com 写道: I was wondering if the following is useful, probably not. Reserve a spot on the vtable, which is automatically set to NULL. class AClass { __virtualspot void caption(string text); //no implementation __virtualspot string caption(); } I think the above is designed for .di files. However, maybe we should limit it to di only. If it's in .d, it probably a bug or workaround of dmd bugs. class BClass:AClass { } BClass b = new BClass(); b.caption = test; //compiles 1. Would compile. But it would not run if the vtable spot has not been filled up by some API. 2. Can derive from the class/interface, without providing the implementation. -- 使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/
Re: The Linker is not a Magical Program
Walter Bright wrote: A rant I wrote a few months ago: http://programmer.97things.oreilly.com/wiki/index.php/The_Linker_Is_not_a_Magical_Program For reference, GNU ld has to be compiled with -linvisible-pink-unicorn.
Re: The Linker is not a Magical Program
Christopher Wright Wrote: Walter Bright wrote: A rant I wrote a few months ago: http://programmer.97things.oreilly.com/wiki/index.php/The_Linker_Is_not_a_Magical_Program For reference, GNU ld has to be compiled with -linvisible-pink-unicorn. How can you know its pink if its also invisible?
Re: The Linker is not a Magical Program
On Fri, Sep 4, 2009 at 12:15 AM, Jeremie Pelletierjerem...@gmail.com wrote: Christopher Wright Wrote: Walter Bright wrote: A rant I wrote a few months ago: http://programmer.97things.oreilly.com/wiki/index.php/The_Linker_Is_not_a_Magical_Program For reference, GNU ld has to be compiled with -linvisible-pink-unicorn. How can you know its pink if its also invisible? Colorless green dreams sleep furiously.
Re: The Linker is not a Magical Program
Jeremie Pelletier wrote: Christopher Wright Wrote: Walter Bright wrote: A rant I wrote a few months ago: http://programmer.97things.oreilly.com/wiki/index.php/The_Linker_Is_not_a_Magical_Program For reference, GNU ld has to be compiled with -linvisible-pink-unicorn. How can you know its pink if its also invisible? http://en.wikipedia.org/wiki/Invisible_pink_unicorn Quoteth: The Invisible Pink Unicorn (IPU) is the goddess of a parody religion used to satirize theistic beliefs, taking the form of a unicorn that is paradoxically both invisible and pink. This makes her a rhetorical illustration used by atheists and other religious skeptics. The IPU is used to argue that supernatural beliefs are arbitrary by, for example, replacing the word God in any theistic statement with Invisible Pink Unicorn. The mutually exclusive attributes of pinkness and invisibility, coupled with the inability to disprove the IPU's existence, is intended to satirize what IPU proponents claim are contradictions in properties that some theists attribute to a theistic deity. ... Invisible Pink Unicorns are beings of great spiritual power. We know this because they are capable of being invisible and pink at the same time. Like all religions, the Faith of the Invisible Pink Unicorns is based upon both logic and faith. We have faith that they are pink; we logically know that they are invisible because we can't see them. — Steve Eley