On Thursday, 24 April 2014 at 20:09:38 UTC, Justin Whear wrote:
You can use GC.addRoot() from core.memory before passing the
pointer to
the C function, then use GC.removeRoot in your myFree function.
Perfect, thanks!
On Thu, 24 Apr 2014 19:55:37 +, Lars T. Kyllingstad wrote:
> Is it possible to temporarily prevent the garbage collector from
> collecting a memory block even if there are no references to it?
>
> The use case is as follows: I want to call a C library function which
> expects to take ownersh
Is it possible to temporarily prevent the garbage collector from
collecting a memory block even if there are no references to it?
The use case is as follows: I want to call a C library function
which expects to take ownership of a buffer. It looks something
like this:
alias FreeFunc =