Opaque handles...

Andrej Mitrovic andrej.mitrovich at gmail.com
Wed Sep 18 09:23:37 PDT 2013


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


More information about the Digitalmars-d mailing list