April 20, 2009
Hello

Save and retrieve a class pointer in a C API is valid? or, the GC will move the class memory and the stored pointer become invalid?

Thanks
April 20, 2009
Fractal wrote:

> Hello
>
> Save and retrieve a class pointer in a C API is valid? or, the GC
> will move the class memory and the stored pointer become invalid?
>
> Thanks

Greetings.

This newsgroup is deprecated. It is suggested you use digitalmars.D or digitalmars.D.learn instaed.

As for your question, D does not have a moving garbage collector, so as long as the instance is alive, its location does not change. So yes, you can allow C functions to store your D pointers.

--
Simen