minimal object.d implementation that allows classes
Adam D. Ruppe
destructionator at gmail.com
Thu Dec 7 14:58:52 UTC 2017
On Wednesday, 6 December 2017 at 18:32:11 UTC, Luís Marques wrote:
> On Wednesday, 6 December 2017 at 17:52:16 UTC, Eugene Wissner
> wrote:
>> http://arsdnet.net/dcode/minimal.zip ?
>
> I tried that one, but I was having trouble getting it to work
> (it seems to have bit rotten), and it does much more than I
> need, which probably is adding to the work to fix it.
Yeah, minimal.zip is getting a bit old, but most the changes
should be fairly small - adjusting sizes mainly. I just haven't
done that for a year or two.
The basic process is compile and link, if something doesn't work,
copy/paste enough in to make the error go away. Sizes can be
gotten from real druntime with __traits(classInstanceSize) and
such, then you put in a dummy buffer to pad to it (remembering
the vptr and monitor already get tou part of the way there).
minimal.zip does a bit more than the bare minimum, but
polymorphic classes DO require a fair chunk of code - various
typeinfo and cast functions, some kind of memory function - and
some of that code requires other code like struct typeinfo too
(ugh, but the compiler insists).
minimal.zip also includes exceptions and some startup stuff but
that's mostly just because such were easy after polymorphism
worked so I did because I can. Of course, if targetting
webassembly, you can prolly cut all that out and rely on the
javascript plumbing instead (i think). Certainly the asm
functions will need to be cut there.
More information about the Digitalmars-d
mailing list