Reference to D class instance with a C library

Jacob Carlborg doob at me.com
Sun Jul 14 23:26:21 PDT 2013


On 2013-07-15 00:06, Leandro Motta Barros wrote:
> The documentation of GC.addRoot() (mentioned by Simen), contains this
> interesting piece of example code:
>
>     // Also ensure that a moving collector does not relocate
>     // the object.
>     GC.setAttr(cast(void*)context, GC.BlkAttr.NO_MOVE);
>
> Looks like we *already* have the way to pin objects to their current
> memory location. (This compiles and is running without errors so far,
> though I didn't try to look if it is actually doing something under
> the hood -- which currently doesn't matter much, since the current GC
> doesn't move objects).
>
> (And yes, a GC.clrAttr() call does exist, too.)

That's good to know about. But as you say, we're not there yet.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list