How to get to a class initializer through introspection?
Adam D. Ruppe
destructionator at gmail.com
Mon Aug 3 14:35:27 UTC 2020
On Monday, 3 August 2020 at 08:04:16 UTC, Johan wrote:
> https://github.com/weka-io/druntime/blob/9e5a36b0fcac242c4d160d3d7d0c85565aebe79f/src/core/internal/lifetime.d#L118
I'm not sure that is a virtual call once it is compiled - it
ought to be a candidate for devirtualization and/or inlining
since the typeinfo class instance is known at compile time. idk
if the implementation actually does that though. The druntime
method isn't marked final (it probably could be... the compiler
puts out different instances of this object, not different
subclasses) but still something like ldc's lto ought to be able
to figure it out.
Regardless, yeah, the pragma(mangle) trick can probably help you
here too at least as a hacky solution. Let me know if you figure
out the incantation to make ldc accept it, or if I come back to
it I'll let you know the solution here too. But for dmd it is
easy.
More information about the Digitalmars-d
mailing list