Is it safe to use 'is' to compare types?

Yuxuan Shui via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Mar 9 17:33:41 PST 2016


On Wednesday, 9 March 2016 at 22:26:38 UTC, Ali Çehreli wrote:
> On 03/09/2016 07:05 AM, Yuxuan Shui wrote:
>
> > Can we left TypeInfo symbol undefined in the shared
> libraries? i.e. D
> > compiler will strip out TypeInfo definition when creating .so.
> > (Alternatively, we can have TypeInfo always undefined in .o,
> and
> > generate them in linking stage only when creating executables)
>
> That would require a linker that's aware of D but as far as I 
> know, all system languages use the system linker.
>
> Ali

Hmm, how about this:

During compilation, D generate undefined TypeInfo symbols, but it 
also embed type information in the object file (like what Rust 
does). And then, when dmd/ldc/gdc/whatever is called for linking 
executables, it will scan object files and generate another 
object file containing the TypeInfos, and link them together with 
the system linker. If the compiler is called for linking shared 
libraries, it doesn't.


More information about the Digitalmars-d-learn mailing list