www.digitalmars.com         C & C++   DMDScript  

D - C APIs and D Classes

reply Fractal <d341055 bsnow.net> writes:
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
Apr 19 2009
parent "Simen Kjaeraas" <simen.kjaras gmail.com> writes:
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
Apr 20 2009