Adding pointers to GC with destructers

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Apr 19 20:30:20 PDT 2015


On Sun, 19 Apr 2015 23:38:47 +0000, 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.

wrap it in class/struct and run `freeObj()` in destructor.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150420/36d1f922/attachment.sig>


More information about the Digitalmars-d-learn mailing list