Adding pointers to GC with destructers

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Apr 19 19:56:35 PDT 2015


On 04/19/2015 04:38 PM, Freddy wrote:
> C libraries have a pattern of
> ----
> HiddenType* getObj();
> void freeObj(HiddenType*);
> ----
> Is there any way I can make the GC search for a "HiddenType*" and run
> "freeObj" when the pointer is not found.

Not automatically. Check out addRange and addRoot:

   http://dlang.org/phobos/core_memory.html

Ali



More information about the Digitalmars-d-learn mailing list