Opaque handles...

Johannes Pfau nospam at example.com
Thu Sep 19 13:33:32 PDT 2013


Am Wed, 18 Sep 2013 18:23:37 +0200
schrieb Andrej Mitrovic <andrej.mitrovich at gmail.com>:

> On 9/18/13, Manu <turkeyman at gmail.com> wrote:
> > But since I'm always dealing with a pointer rather than a real
> > type, I can't implement logic to inc/dec the ref-count on
> > assignment. And how do I handle destruction/garbage collection?
> 
> Ah I see, well you could try using RefCounted from std.typecons.
> 
> For some usage examples you may want to look at how CairoD uses it. It
> exposes D classes and some D structs in the D API which use reference
> counting:
> https://github.com/jpf91/cairoD
> 
> Johannes also did a nice job documenting how memory management is
> dealt with for interfacing with cairo, so this page might be helpful:
> https://github.com/jpf91/cairoD/wiki/Memory-Management

Another project which I really should get back to at some point. Note
that this code is kinda old now and I think some bugs in phobos
RefCounted were fixed since then.


More information about the Digitalmars-d mailing list