On 10/25/2019 07:34 AM, Robert M. Münch wrote:

> If the compiler is a 1-pass one I see the problem, otherwise one could
> first get a "total overview" and create the necessary vtbl entries after
> everything is known. Maybe this is not "how a compiler is implemented"
> but the problem sounds solvable for me.

Unfortunately, it's not the compiler but the linker that produces the program (dmd and others conveniently call the linker behind the scenes).

It's common to compile the compilation units e.g. with "dmd -c" and then link them together at the end. C++ has been suffering from the fact that linkers are language agnostic but the linker is a part of the operating system, so this is what we got.

Otherwise, I would agree with you. But even then, what about dynamic libraries? The library was built with 7 instances of a template but I have 8 instances in my program. This is related to the operating system 'loader', which happens to be the sister of the 'linker'. :)

Ali


Reply via email to