I'm currently using the rtInfo template inside object.d to generate RTTI information for my own little rtti system. It is working really well so far, the only issue I found is as follows:

If a POD struct (which does not contain any reference types, pointers, arrays etc) is placed in a library. And that library is then linked against a executable, the rtInfo of the POD struct will be lost. It will be generated by the compiler when compiling the library, but for some reason it is gone after the final binary is compiled and linked. But as soon as I add a void* pointer to that struct everythings works fine.

Any idea what could be happening there and how to fix it? If the linker stripts the rtInfo out, why does adding a void* make a difference?

The source can be found at:

https://github.com/Ingrater/druntime/blob/master/src/rtti.d
https://github.com/Ingrater/druntime/blob/master/src/object.di

Kind Regards
Benjamin Thaut

Reply via email to