Vtable for virtual functions in D

sarn sarn at theartofmachinery.com
Wed Mar 7 22:02:17 UTC 2018


On Wednesday, 7 March 2018 at 12:49:40 UTC, Guillaume Piolat 
wrote:
> If you know enough D maybe you can implement your own virtual 
> functions on top of D structs. It seems no one has made it yet.

When I wrote Xanthe a year ago, I rolled my own classes using 
alias this and explicit vtables:
https://gitlab.com/sarneaud/xanthe/blob/master/src/game/rigid_body.d#L15
(I did this because normal D classes use the druntime library, 
and Xanthe was an experiment in not using the D runtime at all.)

Henrik: you might be interested in this post I wrote about making 
that:
https://theartofmachinery.com/2017/02/28/bare_metal_d.html
NB: things are moving fast and some things have already improved 
since then.


More information about the Digitalmars-d mailing list