On 4/13/23 20:50, backtrack wrote:
> mystruct* getmystruct()
> {
> mystruct* mystruct = cast(mystruct*)malloc(mystruct.sizeof);
> return mystruct;
>
> }
There must be a corresponding function to do the cleaning:
void freemystruct(mystruct* ptr) {
free ptr;
}
You have to make sure on the D side that freemystruct() is called once
for each getmystruct().
I have the following presentation that covers similar concepts:
https://www.youtube.com/watch?v=FNL-CPX4EuM
I think this point is most relevant:
https://www.youtube.com/watch?v=FNL-CPX4EuM&t=1833s
Ali