C++ and D @ stackoverflow
Walter Bright
newshound1 at digitalmars.com
Sat Jun 12 08:57:35 PDT 2010
Andrei Alexandrescu wrote:
> Leandro Lucarella wrote:
>> Andrei Alexandrescu, el 12 de junio a las 00:32 me escribiste:
>>> BCS wrote:
>>>> http://stackoverflow.com/questions/3024136/link-compatibility-between-c-and-d
>>>>
>>> I just posted an answer that contains a couple of news.
>>
>> As I said with your new RefCounted implementation, unless I'm missing
>> something, there will be problems if you store pointers (or objects that
>> have pointers) to the GC heap, as you never communicate with the GC.
>
> Could you please give an example? Thanks!
All you have to do is for your malloc'd data, tell the gc about it so it can
search the malloc'd data for pointers.
Add the data with:
import core.memory;
addRange(p, size);
and remove it when calling free() with:
removeRange(p);
You don't need to do this if the array elements do not contain any pointers or
references, for example, if they are an array of ints.
More information about the Digitalmars-d
mailing list