F*cked by memory corruption after assiging value to associative array

frame frame86 at live.com
Mon Jan 25 17:11:37 UTC 2021


On Monday, 25 January 2021 at 16:54:42 UTC, vitamin wrote:
> On Monday, 25 January 2021 at 16:44:40 UTC, frame wrote:
>> On Monday, 25 January 2021 at 16:14:05 UTC, vitamin wrote:
>>
>>> [...]
>>
>> Yes with simple new operator.
>> Forgot to mention: the DLL itself calls a DLL.
>>
>> [...]
>
> If there are separated GCs for DLLs, then you must call 
> GC.addRoot() from DLL where you allocate that object.

Yes, I directly calling on every function that returns an object:

T fun(T)(T object) {
   GC.addRoot(cast(void*) object);
}
...
extern (C) export SomeObject bar() {
     return fun(new SomeObject);
}

Wrong way?


More information about the Digitalmars-d-learn mailing list